commit fcccb1789bf4f242f79eddb0a347e863d436f564 Author: ipwxp Date: Thu Sep 25 19:04:00 2025 +0800 frist diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..52a0c3c --- /dev/null +++ b/Makefile @@ -0,0 +1,158 @@ +# Digital Logic +# www.d-logic.net +# +# Helper Makefile +# +#$(VERBOSE).SILENT: + +PRJNAME = nt4h_c_example + +all : help + +help info : + echo "----------------------------------------------" + echo "Making example to test Reader opening function" + echo "Project output name: $(PRJNAME)" + echo "----------------------------------------------" + echo "For 32 bit Windows - type: 'make win32'" + echo "For 64 bit Windows - type: 'make win64'" + echo "For 32 bit Linux - type: 'make lin32'" + echo "For 64 bit Linux - type: 'make lin64'" + echo "For 64 bit Mac OS - type: 'make osx'" + echo "----------------------------------------------" + echo "ARM Linux 交叉編譯選項:" + echo "For ARM 64-bit (aarch64) - type: 'make arm64'" + echo "For ARM 32-bit (armhf) - type: 'make arm32'" + echo "For ARM 32-bit (armel) - type: 'make armel'" + echo "For ARM 64-bit (static) - type: 'make arm64-static'" + echo "For ARM 32-bit (static) - type: 'make arm32-static'" + echo "----------------------------------------------" + echo "API 服務器編譯選項:" + echo "For API Server (x64) - type: 'make api-server'" + echo "For API Server (ARM64) - type: 'make api-server-arm64'" + echo "For API Server (ARM32) - type: 'make api-server-arm32'" + echo "----------------------------------------------" + +lin32 linux32 : + cd linux32_release && gcc -m32 -o $(PRJNAME) ../src/*.c -I../ufr-lib/include -L../ufr-lib/linux/x86 -luFCoder-x86 -Wl,-R../ufr-lib/linux/x86 + echo "Making done, without errors." + echo "To run the example - type:" + echo " 'cd linux32_release && ./$(PRJNAME)'" + +lin64 linux64 : + cd linux64_release && gcc -m64 -o $(PRJNAME) ../src/main.c ../src/utils.c ../src/uFR.c ../src/conio_gnu.c -I../ufr-lib/include -L../ufr-lib/linux/x86_64 -luFCoder-x86_64 -Wl,-R../ufr-lib/linux/x86_64 + echo "Making done, without errors." + echo "To run the example - type:" + echo " 'cd linux64_release && ./$(PRJNAME)'" + +# API 服務器編譯規則 +api-server : + cd linux64_release && gcc -m64 -o cmac_api_server ../src/api_server.c ../src/utils.c -I../ufr-lib/include -L../ufr-lib/linux/x86_64 -luFCoder-x86_64 -lpthread -Wl,-R../ufr-lib/linux/x86_64 + echo "API 服務器編譯完成!" + echo "執行方式: 'cd linux64_release && ./cmac_api_server [port]'" + +# ARM 版本的 API 服務器 +api-server-arm64 : + -mkdir -p arm64_release + aarch64-linux-gnu-gcc -o arm64_release/cmac_api_server src/api_server.c src/utils.c -I./ufr-lib/include -L./ufr-lib/linux/aarch64 -luFCoder-aarch64 -lpthread -lm -Wl,-rpath,./ufr-lib/linux/aarch64 + echo "ARM64 API 服務器編譯完成!" + +api-server-arm32 : + -mkdir -p arm32_release + arm-linux-gnueabihf-gcc -o arm32_release/cmac_api_server src/api_server.c src/utils.c -I./ufr-lib/include -L./ufr-lib/linux/arm-hf -luFCoder-armhf -lpthread -lm -Wl,-rpath,./ufr-lib/linux/arm-hf + echo "ARM32 API 服務器編譯完成!" + +win32 : + echo "If You see error like: 'skipping incompatible ufr-lib/windows/x86/uFCoder-x86.dll when searching for...'" + echo " This means You have the gcc compiler for 64 bit" + echo " type 'make win64' instead of 'make win32'" + echo "" + cd win32_release && gcc -o $(PRJNAME) ../src/*.c -I../ufr-lib/include -L../ufr-lib/windows/x86 -luFCoder-x86 -Wl,-R../ufr-lib/windows/x86 -Wl,--enable-stdcall-fixup + echo "Making done, without errors." + echo "To run the example - type:" + echo " 'cd win32_release'" + echo " 'run_me'" + # generate run_me + echo "@echo off" > win32_release/run_me.cmd + echo "set path=../ufr-lib/windows/x86;%path%" >> win32_release/run_me.cmd + echo "$(PRJNAME)" >> win32_release/run_me.cmd + +win64 : + echo "If You see error like: 'ufr-lib/windows/x86_64/uFCoder-x86_64.dll: file not recognized: File format not recognized'" + echo " This means You have the gcc compiler for 32 bit" + echo " type 'make win32' instead of 'make win64'" + echo "" + cd win64_release && gcc -o $(PRJNAME) ../src/*.c -I../ufr-lib/include -L../ufr-lib/windows/x86_64 -luFCoder-x86_64 -Wl,-R../ufr-lib/windows/x86_64 + echo "Making done, without errors." + echo "You must use library from the 'lib\windows\x86_64\'" + echo "" + echo "To run the example - type:" + echo " 'cd win64_release'" + echo " 'run_me'" + # generate run_me + echo "@echo off" > win64_release/run_me.cmd + echo "set path=../ufr-lib/windows/x86_64;%path%" >> win64_release/run_me.cmd + echo "$(PRJNAME)" >> win64_release/run_me.cmd + +osx : + -mkdir -p macos-x86_64-release + cd macos-x86_64-release && gcc -o $(PRJNAME) -I../ufr-lib/include ../src/*.c -L../ufr-lib/macos/x86_64 -luFCoder-x86_64 -Xlinker -rpath ../ufr-lib/macos/x86_64/ + install_name_tool -change "libuFCoder-x86_64.dylib" "@loader_path/../ufr-lib/macos/x86_64/ufr-libuFCoder-x86_64.dylib" macos-x86_64-release/$(PRJNAME) + echo "Making on 64-bit Intel macOS is done - without errors." + echo "Output is in macos-x86_64-release/" + echo + # running help message + echo "You must use library from the 'ufr-lib/macos/x86_64'" + echo "" + echo "To run the example - type:" + echo " 'cd macos-x86_64-release && ./$(PRJNAME)'" + +# ARM Linux 交叉編譯規則 +arm64 aarch64 linux-arm64 : + -mkdir -p arm64_release + aarch64-linux-gnu-gcc -o arm64_release/$(PRJNAME) src/*.c -I./ufr-lib/include -L./ufr-lib/linux/aarch64 -luFCoder-aarch64 -lm -Wl,-rpath,./ufr-lib/linux/aarch64 + echo "ARM64 編譯完成!" + echo "輸出位置: arm64_release/" + echo "執行方式: 'cd arm64_release && ./$(PRJNAME)'" + echo "注意: 需要將 ufr-lib/linux/aarch64/ 目錄複製到目標 ARM64 設備" + +arm32 armhf linux-arm32 : + -mkdir -p arm32_release + arm-linux-gnueabihf-gcc -o arm32_release/$(PRJNAME) src/*.c -I./ufr-lib/include -L./ufr-lib/linux/arm-hf -luFCoder-armhf -lm -Wl,-rpath,./ufr-lib/linux/arm-hf + echo "ARM32 (hard float) 編譯完成!" + echo "輸出位置: arm32_release/" + echo "執行方式: 'cd arm32_release && ./$(PRJNAME)'" + echo "注意: 需要將 ufr-lib/linux/arm-hf/ 目錄複製到目標 ARM32 設備" + +armel linux-armel : + -mkdir -p armel_release + arm-linux-gnueabi-gcc -o armel_release/$(PRJNAME) src/*.c -I./ufr-lib/include -L./ufr-lib/linux/arm-el -luFCoder-armel -lm -Wl,-rpath,./ufr-lib/linux/arm-el + echo "ARM (little endian) 編譯完成!" + echo "輸出位置: armel_release/" + echo "執行方式: 'cd armel_release && ./$(PRJNAME)'" + echo "注意: 需要將 ufr-lib/linux/arm-el/ 目錄複製到目標 ARMEL 設備" + +# ARM 靜態連結版本 (無需動態函式庫) +arm64-static aarch64-static : + -mkdir -p arm64_static_release + aarch64-linux-gnu-gcc -static -DDL_USE_STATIC_LIB -o arm64_static_release/$(PRJNAME) src/*.c -I./ufr-lib/include -L./ufr-lib/linux/static-aarch64 -luFCoder-aarch64 -lpthread -ldl -lm + echo "ARM64 靜態編譯完成!" + echo "輸出位置: arm64_static_release/" + echo "執行方式: 'cd arm64_static_release && ./$(PRJNAME)'" + echo "優點: 無需額外函式庫,可直接在 ARM64 設備上執行" + +arm32-static armhf-static : + -mkdir -p arm32_static_release + arm-linux-gnueabihf-gcc -static -DDL_USE_STATIC_LIB -o arm32_static_release/$(PRJNAME) src/*.c -I./ufr-lib/include -L./ufr-lib/linux/static-armhf -luFCoder-armhf -lpthread -ldl -lm + echo "ARM32 靜態編譯完成!" + echo "輸出位置: arm32_static_release/" + echo "執行方式: 'cd arm32_static_release && ./$(PRJNAME)'" + echo "優點: 無需額外函式庫,可直接在 ARM32 設備上執行" + +# 檢查交叉編譯工具 +check-cross-tools : + echo "檢查 ARM 交叉編譯工具..." + which aarch64-linux-gnu-gcc || echo "❌ 缺少 aarch64-linux-gnu-gcc (安裝: sudo apt install gcc-aarch64-linux-gnu)" + which arm-linux-gnueabihf-gcc || echo "❌ 缺少 arm-linux-gnueabihf-gcc (安裝: sudo apt install gcc-arm-linux-gnueabihf)" + which arm-linux-gnueabi-gcc || echo "❌ 缺少 arm-linux-gnueabi-gcc (安裝: sudo apt install gcc-arm-linux-gnueabi)" + echo "檢查完成!" diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd946bf --- /dev/null +++ b/README.md @@ -0,0 +1,366 @@ +# 🔧 NFC 生產工具 + +## 📋 專案概述 + +這是一個整合式的 NFC 生產工具,結合了 C 語言核心程式與 Flask Web 介面,提供完整的 NFC 卡片生產、認證和管理功能。支援 SDM 加密、CMAC 認證、API 整合等進階功能。 + +### 🎯 主要功能 +- **📝 生產新SDM**:完整的 SDM 生產流程(變更金鑰 → 設定SDM → CMAC認證 → API上傳) +- **🔍 檢驗NFC**:本地認證成功後自動POST到檢驗API +- **🔐 本地CMAC認證**:本地認證 + 遠端線上認證 +- **🧪 完整測試NFC**:預處理 + 完整功能測試 +- **📖 讀取UID**:批次讀取所有NFC卡片 +- **Web 管理介面**:直觀的網頁操作介面 +- **URL 管理**:線上編輯和管理 URLs.txt +- **即時監控**:WebSocket 即時顯示執行狀態 +- **API 整合**:支援 Bearer Token 認證的 API 通訊 + +## 🚀 快速開始 + +### 1. 系統需求 +- **作業系統**:Ubuntu 18.04+ / CentOS 7+ / Debian 9+ +- **Python**:3.7 或以上版本 +- **硬體**:uFR NFC 讀卡機 +- **網路**:用於 API 通訊和遠端認證 + +### 2. 一鍵安裝 +```bash +# 下載專案 +git clone +cd ufr_zero_nt4h(WEB) + +# 執行安裝腳本 +chmod +x install.sh +./install.sh +``` + +**安裝腳本功能**: +- 🔍 自動檢測作業系統(Ubuntu/Debian/CentOS/RHEL) +- 📦 自動安裝系統依賴套件 +- 🔌 設定 USB 裝置權限(uFR 讀卡機) +- 🐍 創建 Python 虛擬環境 +- 📁 設定檔案權限 +- ⚙️ 可選創建 systemd 服務 +- 🧹 自動清理現有服務配置 + +### 3. 手動安裝 +```bash +# 1. 安裝 Python 依賴 +pip install -r requirements.txt + +# 2. 設定執行權限 +chmod +x linux64_release/nt4h_c_example +chmod +x start.sh + +# 3. 啟動應用程式 +./start.sh +``` + +### 4. 啟動方式 + +#### 方式一:直接啟動 +```bash +./start.sh +``` + +#### 方式二:背景執行 +```bash +nohup ./start.sh > app.log 2>&1 & +``` + +#### 方式三:systemd 服務(推薦) +```bash +# 啟動服務 +sudo systemctl start NFCapp.service + +# 啟用開機自啟 +sudo systemctl enable NFCapp.service + +# 查看服務狀態 +sudo systemctl status NFCapp.service + +# 查看服務日誌 +sudo journalctl -u NFCapp.service -f +``` + +### 5. 訪問應用程式 +開啟瀏覽器訪問:`http://localhost:5000` + +## 🔧 安裝腳本詳解 + +### install.sh 功能說明 + +安裝腳本 `install.sh` 提供完整的自動化安裝流程: + +#### 🔍 系統檢測 +- 自動檢測作業系統類型(Ubuntu/Debian/CentOS/RHEL) +- 檢查 Python 版本(需要 3.7+) +- 驗證必要檔案存在 + +#### 📦 依賴安裝 +- **Ubuntu/Debian**:安裝 python3, python3-pip, python3-venv, gcc, make, curl, wget +- **CentOS/RHEL**:安裝 python3, python3-pip, gcc, make, curl, wget + +#### 🔌 USB 權限設定 +- 創建 udev 規則檔案 `/etc/udev/rules.d/99-ufr.rules` +- 支援多種 uFR 讀卡機型號(6001, 6014, 6015) +- 自動將使用者加入 dialout 群組 +- 重新載入 udev 規則 + +#### 🐍 Python 環境 +- 檢查並重新創建虛擬環境(如果已存在) +- 升級 pip 到最新版本 +- 安裝 requirements.txt 中的所有依賴 + +#### 📁 檔案權限 +- 設定執行檔權限 +- 設定設定檔權限(keys.txt, urls.txt) + +#### ⚙️ systemd 服務管理 +- **自動清理**:檢查並刪除現有的 `NFCapp.service` +- **服務停止**:停止正在運行的服務 +- **服務禁用**:禁用已啟用的服務 +- **檔案刪除**:刪除舊的服務檔案 +- **配置重載**:重新載入 systemd 配置 +- **可選創建**:詢問使用者是否創建新的 systemd 服務 + +#### 🎨 使用者體驗 +- 彩色日誌輸出(INFO, SUCCESS, WARNING, ERROR) +- 詳細的安裝進度顯示 +- 完整的安裝完成資訊 +- 服務管理指令說明 + +## 🎮 使用說明 + +### 主要操作 + +#### 📝 生產新SDM +完整的 SDM 生產流程: +1. 自動尋找可用的 oldkey +2. 變更金鑰到選擇的 KEY +3. 設定 SDM 功能 +4. 執行 CMAC 認證 +5. 自動 POST 到生產 API + +**API 端點**:`{API_URL}/nfc/insertForProduction` +**POST 格式**: +```json +{ + "uid": "04296A5AD51F90", + "ctr": "00000A", + "key": "1" +} +``` + +#### 🔍 檢驗NFC +檢驗現有 NFC 卡片: +1. 執行本地 CMAC 認證 +2. 解析 UID +3. 自動 POST 到檢驗 API + +**API 端點**:`{API_URL}/nfc/verifyForProduction` +**POST 格式**: +```json +{ + "uid": "04296A5AD51F90" +} +``` + +#### 🔐 本地CMAC認證 +雙重認證流程: +1. 本地 CMAC 認證 +2. 遠端線上認證(https://verify.contree.app/verify) + +#### 🧪 完整測試NFC +預處理 + 完整測試: +1. 讀取 UID 尋找可用 KEY +2. 強制更換到 key 1 +3. 執行完整測試腳本 + +#### 📖 讀取UID +批次讀取所有 NFC 卡片,找到第一個可讀取的卡片後停止。 + +### 設定選項 +- **選擇 Key**:選擇要使用的金鑰(從 keys.txt) +- **選擇 URL**:選擇要寫入的 URL(從 urls.txt) +- **選擇 NFC 名稱**:選擇或新增 NFC 卡片名稱 +- **資料API URL**:設定 API 伺服器位址 +- **API Token**:設定 Bearer Token 認證 + +### 工具操作 +- **🔄 重新整理選項**:重新載入 keys.txt 和 urls.txt +- **🗑️ 清除執行結果**:清除輸出區域內容 +- **✏️ 編輯URL**:開啟 URL 編輯視窗 +- **⬇️ 到底部**:自動滾動到輸出底部 +- **⬆️ 到頂部**:自動滾動到輸出頂部 + +## 📁 檔案結構 + +``` +ufr_zero_nt4h(WEB)/ +├── app.py # Flask Web 應用程式主檔 +├── start.sh # Linux 啟動腳本 +├── requirements.txt # Python 依賴套件 +├── config.json # 應用程式設定檔 +├── templates/ +│ ├── index.html # 主頁面 +│ └── manual_test.html # 手動測試頁面 +├── linux64_release/ # Linux 64位執行檔目錄 +│ ├── nt4h_c_example # 核心 NFC 程式 +│ ├── keys.txt # 金鑰檔案 +│ ├── urls.txt # URL 設定檔 +│ └── libnt4h_c.so # uFR 函式庫 +└── src/ # C 語言原始碼 + ├── main.c # 主程式 + ├── uFR.c # uFR 介面 + └── utils.c # 工具函式 +``` + +## ⚙️ 設定說明 + +### config.json +```json +{ + "api_url": "https://your-api-server.com", + "api_token": "Bearer eyJhbGciOiJIUzI1NiJ9...", + "name": "default-name", + "names": ["name1", "name2"] +} +``` + +### API 設定 +- **資料API URL**:設定 API 伺服器基礎位址 +- **API Token**:設定 Bearer Token 用於 API 認證 +- **自動認證**:所有 API 請求都會自動包含 Bearer Token + +### keys.txt +每行一個 AES 金鑰,用於 NFC 卡片加密。 + +### urls.txt +每行一個 URL,前三行為系統保留,從第四行開始可編輯。 + +## 🔧 手動測試 + +訪問 `http://localhost:5000/manual_test` 進行手動測試: +- 快速 SDM 設定 +- NDEF 操作 +- 變更 AES 金鑰 +- 讀取 UID +- 自定義指令執行 +- 手動 CMAC 認證 +- 手動 API 驗證 + +## 🌐 API 整合 + +### 支援的 API 端點 + +#### 生產 API +- **端點**:`POST {API_URL}/nfc/insertForProduction` +- **用途**:新增生產的 NFC 卡片資料 +- **認證**:Bearer Token +- **資料格式**:JSON + +#### 檢驗 API +- **端點**:`POST {API_URL}/nfc/verifyForProduction` +- **用途**:檢驗現有 NFC 卡片 +- **認證**:Bearer Token +- **資料格式**:JSON + +#### 遠端認證 API +- **端點**:`GET https://verify.contree.app/verify` +- **用途**:線上 CMAC 認證 +- **認證**:無需認證 +- **回應格式**:JSON + +### API 回應範例 + +#### 成功回應 +```json +{ + "success": true, + "message": "Operation completed successfully", + "timestamp": "2025-01-24T12:52:18Z" +} +``` + +#### 錯誤回應 +```json +{ + "success": false, + "message": "Error description", + "error_code": "ERROR_CODE" +} +``` + +## 🐛 故障排除 + +### 常見問題 +1. **讀卡機無法連接**:檢查 uFR 讀卡機是否正確連接 +2. **權限錯誤**:確保執行檔有執行權限 +3. **依賴缺失**:執行 `pip install -r requirements.txt` +4. **WebSocket 連接問題**:檢查防火牆設定,確保 5000 端口開放 +5. **API 認證失敗**:檢查 API Token 是否正確設定 +6. **本地認證失敗**:檢查 keys.txt 中的金鑰是否正確 +7. **遠端認證失敗**:檢查網路連接和遠端認證服務狀態 +8. **USB 權限問題**:重新載入 udev 規則 + ```bash + sudo udevadm control --reload-rules + sudo udevadm trigger + ``` +9. **systemd 服務問題**:檢查服務狀態和日誌 + ```bash + sudo systemctl status NFCapp.service + sudo journalctl -u NFCapp.service -f + ``` + +### 日誌查看 +應用程式會即時顯示執行日誌,包含顏色標示和詳細錯誤訊息。 + +### 功能特色 +- **即時輸出**:WebSocket 即時顯示執行過程 +- **顏色標示**:支援 ANSI 顏色代碼顯示 +- **自動重連**:WebSocket 自動重連機制 +- **錯誤處理**:完整的錯誤處理和提示 +- **API 整合**:自動 API 認證和資料上傳 +- **雙重認證**:本地 + 遠端認證機制 +- **智能檢測**:自動檢測可用金鑰和錯誤碼 +- **JSON 格式**:標準化的 API 通訊格式 + +## 📞 技術支援 + +如有問題,請檢查: +1. 硬體連接是否正常 +2. 設定檔是否正確 +3. 執行日誌中的錯誤訊息 + +## 📋 更新日誌 + +### v2.1.0 (2025-01-24) +- ✅ 改進安裝腳本功能 +- ✅ 新增自動作業系統檢測 +- ✅ 新增 USB 裝置權限自動設定 +- ✅ 新增 systemd 服務自動管理 +- ✅ 新增現有服務自動清理功能 +- ✅ 改進錯誤處理和日誌顯示 +- ✅ 新增多種啟動方式說明 + +### v2.0.0 (2025-01-24) +- ✅ 新增「生產新SDM」完整流程 +- ✅ 新增「檢驗NFC」功能 +- ✅ 新增「本地CMAC認證」雙重認證 +- ✅ 更新「完整測試NFC」預處理流程 +- ✅ 整合 API 通訊功能 +- ✅ 支援 Bearer Token 認證 +- ✅ 新增 JSON 格式 API 通訊 +- ✅ 改進錯誤處理和狀態檢測 +- ✅ 新增遠端認證整合 + +### v1.0.0 (2024-01) +- ✅ 基礎 NFC 生產工具 +- ✅ Web 介面 +- ✅ 手動測試功能 + +--- + +**版本**:2.1.0 +**更新日期**:2025年1月24日 \ No newline at end of file diff --git a/app.py b/app.py new file mode 100644 index 0000000..79a00cf --- /dev/null +++ b/app.py @@ -0,0 +1,1193 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +整合 NFC 生產工具與腳本執行監控 +Flask + Flask-SocketIO +""" + +# 必須在導入其他模組之前執行 eventlet.monkey_patch() +import eventlet +eventlet.monkey_patch() + +import os +import subprocess +import threading +import queue +import re +from datetime import datetime +from flask import Flask, render_template, request, jsonify +from flask_socketio import SocketIO, emit +from os.path import dirname, basename, abspath +import json +import shutil +import urllib.parse +import requests + + +app = Flask(__name__) +app.config['SECRET_KEY'] = 'nfc_web_controller_secret_key' +socketio = SocketIO(app, cors_allowed_origins="*") + +exe_dir = 'linux64_release' +CONFIG_FILE = 'config.json' + +def load_config(): + """載入設定檔""" + if os.path.exists(CONFIG_FILE): + with open(CONFIG_FILE, 'r', encoding='utf-8') as f: + return json.load(f) + return {'api_url': ''} + +def save_config(config): + """儲存設定檔""" + with open(CONFIG_FILE, 'w', encoding='utf-8') as f: + json.dump(config, f, ensure_ascii=False, indent=2) + +# 載入設定 +config = load_config() + +def get_keys_path(): + return os.path.join(exe_dir, 'keys.txt') +def get_urls_path(): + return os.path.join(exe_dir, 'urls.txt') +def get_default_exe_path(): + return os.path.join(exe_dir, 'nt4h_c_example') + +nt4h_exe_path = get_default_exe_path() +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/api/set_exe_dir', methods=['POST']) +def api_set_exe_dir(): + global exe_dir, nt4h_exe_path + data = request.get_json() + new_dir = data.get('exe_dir') + if not new_dir or not os.path.isdir(new_dir): + return jsonify({'success': False, 'message': '資料夾不存在'}), 400 + exe_dir = new_dir + # 跟著自動切換執行檔路徑 + nt4h_exe_path = get_default_exe_path() + return jsonify({'success': True, 'exe_dir': exe_dir, 'exe_path': nt4h_exe_path}) + +@app.route('/api/keys') +def api_keys(): + keys_path = get_keys_path() + if not os.path.exists(keys_path): + return jsonify({'success': False, 'message': '找不到 keys.txt'}), 404 + with open(keys_path, 'r', encoding='utf-8') as f: + keys = [line.strip() for line in f if line.strip()] + return jsonify({'success': True, 'keys': keys}) + +@app.route('/api/urls') +def api_urls(): + urls_path = get_urls_path() + if not os.path.exists(urls_path): + return jsonify({'success': False, 'message': '找不到 urls.txt'}), 404 + with open(urls_path, 'r', encoding='utf-8') as f: + urls = [line.strip() for line in f if line.strip()] + return jsonify({'success': True, 'urls': urls}) + +@app.route('/api/get_url_by_index', methods=['POST']) +def api_get_url_by_index(): + """根據索引獲取特定 URL""" + data = request.get_json() + index = data.get('index') + if not index or not index.isdigit(): + return jsonify({'success': False, 'message': '無效的索引'}), 400 + + urls_path = get_urls_path() + if not os.path.exists(urls_path): + return jsonify({'success': False, 'message': '找不到 urls.txt'}), 404 + + with open(urls_path, 'r', encoding='utf-8') as f: + urls = [line.strip() for line in f if line.strip()] + + idx = int(index) - 1 # 轉換為 0-based 索引 + if idx < 0 or idx >= len(urls): + return jsonify({'success': False, 'message': '索引超出範圍'}), 400 + + return jsonify({'success': True, 'url': urls[idx], 'index': index}) + +@app.route('/api/update_url_by_index', methods=['POST']) +def api_update_url_by_index(): + """更新特定索引的 URL""" + data = request.get_json() + index = data.get('index') + new_url = data.get('url', '').strip() + + if not index or not index.isdigit(): + return jsonify({'success': False, 'message': '無效的索引'}), 400 + + if not new_url: + return jsonify({'success': False, 'message': 'URL 不得為空'}), 400 + + urls_path = get_urls_path() + if not os.path.exists(urls_path): + return jsonify({'success': False, 'message': '找不到 urls.txt'}), 404 + + # 讀取所有 URL + with open(urls_path, 'r', encoding='utf-8') as f: + urls = [line.strip() for line in f if line.strip()] + + idx = int(index) - 1 # 轉換為 0-based 索引 + if idx < 0 or idx >= len(urls): + return jsonify({'success': False, 'message': '索引超出範圍'}), 400 + + # 更新 URL + urls[idx] = new_url + + # 寫回檔案 + try: + with open(urls_path, 'w', encoding='utf-8') as f: + for url in urls: + f.write(url + '\n') + return jsonify({'success': True, 'message': 'URL 更新成功'}) + except Exception as e: + return jsonify({'success': False, 'message': f'寫入檔案失敗: {e}'}), 500 + +@app.route('/api/add_url', methods=['POST']) +def api_add_url(): + """添加新的 URL""" + data = request.get_json() + new_url = data.get('url', '').strip() + + if not new_url: + return jsonify({'success': False, 'message': 'URL 不得為空'}), 400 + + urls_path = get_urls_path() + if not os.path.exists(urls_path): + return jsonify({'success': False, 'message': '找不到 urls.txt'}), 404 + + # 讀取現有 URL + with open(urls_path, 'r', encoding='utf-8') as f: + urls = [line.strip() for line in f if line.strip()] + + # 添加新 URL + urls.append(new_url) + + # 寫回檔案 + try: + with open(urls_path, 'w', encoding='utf-8') as f: + for url in urls: + f.write(url + '\n') + return jsonify({'success': True, 'message': 'URL 添加成功', 'new_index': len(urls)}) + except Exception as e: + return jsonify({'success': False, 'message': f'寫入檔案失敗: {e}'}), 500 + +@app.route('/api/delete_url_by_index', methods=['POST']) +def api_delete_url_by_index(): + """刪除特定索引的 URL""" + data = request.get_json() + index = data.get('index') + + if not index or not index.isdigit(): + return jsonify({'success': False, 'message': '無效的索引'}), 400 + + urls_path = get_urls_path() + if not os.path.exists(urls_path): + return jsonify({'success': False, 'message': '找不到 urls.txt'}), 404 + + # 讀取所有 URL + with open(urls_path, 'r', encoding='utf-8') as f: + urls = [line.strip() for line in f if line.strip()] + + idx = int(index) - 1 # 轉換為 0-based 索引 + if idx < 0 or idx >= len(urls): + return jsonify({'success': False, 'message': '索引超出範圍'}), 400 + + # 刪除 URL + deleted_url = urls.pop(idx) + + # 寫回檔案 + try: + with open(urls_path, 'w', encoding='utf-8') as f: + for url in urls: + f.write(url + '\n') + return jsonify({'success': True, 'message': 'URL 刪除成功', 'deleted_url': deleted_url}) + except Exception as e: + return jsonify({'success': False, 'message': f'寫入檔案失敗: {e}'}), 500 + +@app.route('/api/save_urls_file', methods=['POST']) +def api_save_urls_file(): + """保存整個 URLs 文件內容""" + data = request.get_json() + urls_content = data.get('urls_content', '') + + urls_path = get_urls_path() + + try: + # 將內容按行分割,過濾空行 + urls = [line.strip() for line in urls_content.split('\n') if line.strip()] + + # 寫入檔案 + with open(urls_path, 'w', encoding='utf-8') as f: + for url in urls: + f.write(url + '\n') + + return jsonify({'success': True, 'message': 'URLs 文件保存成功', 'urls_count': len(urls)}) + except Exception as e: + return jsonify({'success': False, 'message': f'寫入檔案失敗: {e}'}), 500 + +@app.route('/api/set_exe_path', methods=['POST']) +def api_set_exe_path(): + global nt4h_exe_path + data = request.get_json() + exe_path = data.get('exe_path') + if not exe_path or not os.path.isfile(exe_path): + return jsonify({'success': False, 'message': '檔案不存在'}), 400 + nt4h_exe_path = exe_path + return jsonify({'success': True, 'exe_path': nt4h_exe_path}) + +@app.route('/api/set_api_url', methods=['POST']) +def api_set_api_url(): + global config + data = request.get_json() + api_url = data.get('api_url') + if not api_url: + return jsonify({'success': False, 'message': '未提供 API URL'}), 400 + config['api_url'] = api_url + save_config(config) + return jsonify({'success': True, 'api_url': api_url}) + +@app.route('/api/set_api_token', methods=['POST']) +def api_set_api_token(): + global config + data = request.get_json() + api_token = data.get('api_token') + if not api_token: + return jsonify({'success': False, 'message': '未提供 API Token'}), 400 + config['api_token'] = api_token + save_config(config) + return jsonify({'success': True, 'message': 'API Token 設定成功'}) + +@app.route('/api/get_api_token') +def api_get_api_token(): + return jsonify({'api_token': config.get('api_token', '')}) + +@app.route('/api/get_api_url') +def api_get_api_url(): + return jsonify({'api_url': config.get('api_url', '')}) + +@app.route('/api/get_name') +def api_get_name(): + return jsonify({'name': config.get('name', '')}) + +@app.route('/api/set_name', methods=['POST']) +def api_set_name(): + data = request.get_json() + name = data.get('name', '') + config['name'] = name + save_config(config) + return jsonify({'success': True, 'name': name}) + +@app.route('/api/get_names', methods=['GET']) +def api_get_names(): + names = config.get('names', []) + current = config.get('name', '') + return jsonify({'names': names, 'current': current}) + +@app.route('/api/add_name', methods=['POST']) +def api_add_name(): + data = request.get_json() + name = data.get('name', '').strip() + if not name: + return jsonify({'success': False, 'message': '名稱不得為空'}), 400 + names = config.get('names', []) + if name not in names: + names.append(name) + config['names'] = names + # 不自動設定為當前選擇,保持空白 + save_config(config) + return jsonify({'success': True, 'names': names, 'current': ''}) + +@app.route('/api/delete_name', methods=['POST']) +def api_delete_name(): + data = request.get_json() + name = data.get('name', '').strip() + if not name: + return jsonify({'success': False, 'message': '名稱不得為空'}), 400 + names = config.get('names', []) + if name in names: + names.remove(name) + config['names'] = names + # 如果刪除的是當前選中的名稱,清空當前選擇 + if config.get('name') == name: + config['name'] = '' + save_config(config) + return jsonify({'success': True, 'names': names, 'current': config.get('name', '')}) + else: + return jsonify({'success': False, 'message': '名稱不存在'}), 400 + +def run_and_emit(cmd, exe_dir, success_keywords=None, stop_on_success=False): + """ + 執行指令並即時推送結果到前端。 + 若 success_keywords 有設定,遇到任一關鍵字就回傳 True(可用於 early stop)。 + """ + socketio.emit('script_output', {'line': f'$ {" ".join(cmd)}'}) + try: + import os + import select + import sys + + # 設定環境變數確保即時輸出 + env = os.environ.copy() + env['PYTHONUNBUFFERED'] = '1' + env['PYTHONIOENCODING'] = 'utf-8' + + # 使用 pty 來獲得更真實的終端體驗 + try: + import pty + master, slave = pty.openpty() + + proc = subprocess.Popen(cmd, cwd=exe_dir, stdout=slave, stderr=slave, + stdin=slave, env=env, preexec_fn=os.setsid) + os.close(slave) + + output_lines = [] + success = False + + # 使用 select 來非阻塞讀取 + while True: + try: + # 檢查進程是否還在運行 + if proc.poll() is not None: + break + + # 使用 select 等待數據 + ready, _, _ = select.select([master], [], [], 0.1) + + if ready: + data = os.read(master, 1024).decode('utf-8', errors='ignore') + if data: + # 按行分割並發送 + lines = data.split('\n') + for i, line in enumerate(lines): + if i < len(lines) - 1: # 完整的行 + clean_line = line.rstrip('\r') + if clean_line: # 只發送非空行 + socketio.emit('script_output', {'line': clean_line}) + output_lines.append(clean_line) + + # 檢查成功關鍵字 + if success_keywords and any(kw in clean_line for kw in success_keywords): + success = True + if stop_on_success: + proc.terminate() + break + else: # 最後一行可能不完整 + if line.strip(): + # 保存到緩衝區,等待更多數據 + pass + + if success and stop_on_success: + break + + except OSError: + break + + # 讀取剩餘的輸出 + try: + remaining = os.read(master, 4096).decode('utf-8', errors='ignore') + if remaining: + for line in remaining.split('\n'): + clean_line = line.rstrip('\r') + if clean_line: + socketio.emit('script_output', {'line': clean_line}) + output_lines.append(clean_line) + except OSError: + pass + + os.close(master) + proc.wait() + + except ImportError: + # 如果 pty 不可用,回退到標準方法 + proc = subprocess.Popen(cmd, cwd=exe_dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + universal_newlines=True, bufsize=1, env=env) + output_lines = [] + success = False + + for line in iter(proc.stdout.readline, ''): + if line: + clean_line = line.rstrip('\r\n') + socketio.emit('script_output', {'line': clean_line}) + output_lines.append(clean_line) + + if success_keywords and any(kw in clean_line for kw in success_keywords): + success = True + if stop_on_success: + break + + proc.wait() + + return output_lines, success + except Exception as e: + socketio.emit('script_output', {'line': f'執行指令時發生錯誤: {e}'}) + return [], False + +def find_valid_oldkey(keys, exe_file, exe_dir): + """ + 依序 getuid --key <行號>,遇到成功就停下,回傳 (oldkey行號, output_lines) + """ + for idx in range(len(keys)): + key_no = str(idx+1) + cmd = [f'./{exe_file}', 'getuid', '--key', key_no] + output_lines, success = run_and_emit(cmd, exe_dir, success_keywords=['成功讀取 UID', '=== UID 讀取完成 ==='], stop_on_success=False) + if success: + socketio.emit('script_output', {'line': f'找到可用 oldkey:第{key_no}行'}) + return key_no, output_lines + return None, [] + +@app.route('/api/run', methods=['POST']) +def api_run(): + data = request.get_json() + key = data.get('key') + url = data.get('url') + name = data.get('name', '') + if not key: + return jsonify({'success': False, 'message': '未選擇 key'}), 400 + + # 儲存名稱到 config + if name: + config['name'] = name + save_config(config) + + thread = threading.Thread(target=run_nfc_produce, args=(key, url, name)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始執行生產新SDM流程'}) + +def run_nfc_produce(newkey, url, name=''): + keys_path = get_keys_path() + if not os.path.exists(keys_path): + socketio.emit('script_output', {'line': '找不到 keys.txt,無法生產NFC'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + with open(keys_path, 'r', encoding='utf-8') as f: + keys = [line.strip() for line in f if line.strip()] + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + oldkey, _ = find_valid_oldkey(keys, exe_file, exe_dir) + if not oldkey: + socketio.emit('script_output', {'line': '未找到可用的 oldkey,流程結束'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + + # 執行 changekey + socketio.emit('script_output', {'line': '🔄 開始變更金鑰...'}) + cmd = [f'./{exe_file}', 'changekey', '--auth-key', oldkey, '--new-key', newkey, '--old-key', oldkey, '--key-no', '0'] + output_lines, success = run_and_emit(cmd, exe_dir, success_keywords=['成功變更金鑰', '金鑰變更完成'], stop_on_success=False) + + if not success: + socketio.emit('script_output', {'line': '❌ 變更金鑰失敗,流程結束'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + + socketio.emit('script_output', {'line': '✅ 成功變更金鑰!'}) + + # 執行 setsdm + socketio.emit('script_output', {'line': '🔄 開始設定 SDM...'}) + cmd = [f'./{exe_file}', 'setsdm', '--url', url, '--key', newkey] + output_lines, success = run_and_emit(cmd, exe_dir, success_keywords=['快速 SDM 設定完成', 'SDM 設定完成'], stop_on_success=False) + + if not success: + socketio.emit('script_output', {'line': '❌ 設定 SDM 失敗,流程結束'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + + socketio.emit('script_output', {'line': '✅ 成功設定 SDM!'}) + + # 執行 verify + socketio.emit('script_output', {'line': '🔄 開始 CMAC 認證...'}) + cmd = [f'./{exe_file}', 'verify', '--key', newkey] + output_lines, success = run_and_emit(cmd, exe_dir) + + # 解析 verify 結果 + uid, sdm_ctr, cmac, key_value = parse_verify_output(output_lines, newkey, keys) + + if uid and sdm_ctr and cmac: + socketio.emit('script_output', {'line': f'✅ CMAC 認證成功!'}) + socketio.emit('script_output', {'line': f'UID: {uid}'}) + socketio.emit('script_output', {'line': f'SDM 讀取計數器: {sdm_ctr}'}) + socketio.emit('script_output', {'line': f'ASCII MAC 資料: {cmac}'}) + + # POST 到 API + post_to_api(uid, sdm_ctr, cmac, newkey, name) + else: + socketio.emit('script_output', {'line': '❌ CMAC 認證失敗,無法解析結果'}) + + socketio.emit('script_finished', {'message': '生產新SDM流程結束'}) + +@app.route('/api/read_nfc', methods=['POST']) +def api_read_nfc(): + thread = threading.Thread(target=read_nfc) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始批次讀取所有NFC'}) + +def read_nfc(): + keys_path = get_keys_path() + if not os.path.exists(keys_path): + socketio.emit('script_output', {'line': '找不到 keys.txt,無法批次讀取NFC'}) + socketio.emit('script_finished', {'message': '讀取結束'}) + return + with open(keys_path, 'r', encoding='utf-8') as f: + keys = [line.strip() for line in f if line.strip()] + exe_dir_path = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + for idx in range(len(keys)): + key_no = str(idx+1) + cmd = [f'./{exe_file}', 'getuid', '--key', key_no] + output_lines, success = run_and_emit(cmd, exe_dir_path, success_keywords=['成功讀取 UID', '=== UID 讀取完成 ==='], stop_on_success=False) + if success: + socketio.emit('script_output', {'line': f'成功讀取到 UID,停止讀取'}) + break + socketio.emit('script_finished', {'message': '讀取結束'}) + +@app.route('/api/verify', methods=['POST']) +def api_verify(): + data = request.get_json() + key = data.get('key') + name = data.get('name', '') + if not key: + return jsonify({'success': False, 'message': '未選擇 key'}), 400 + + # 儲存名稱到 config + if name: + config['name'] = name + save_config(config) + + thread = threading.Thread(target=verify_nfc, args=(key, name)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始 CMAC 認證流程'}) + +def parse_verify_output(output_lines, key_no, keys): + uid = None + sdm_ctr = None + cmac = None + for line in output_lines: + if 'UID:' in line: + uid = line.split('UID:')[1].strip() + elif 'SDM 讀取計數器:' in line: + sdm_ctr = line.split('SDM 讀取計數器:')[1].strip() + elif 'ASCII MAC 資料:' in line: + cmac = line.split('ASCII MAC 資料:')[1].strip() + key_value = keys[int(key_no)-1] if key_no and key_no.isdigit() and 0 < int(key_no) <= len(keys) else '' + return uid, sdm_ctr, cmac, key_value + +def post_to_api(uid, sdm_ctr, cmac, key_index, name=''): + """將 UID、SDM 計數器、CMAC 資料 POST 到指定的 API URL""" + api_url = config.get('api_url', '') + if not api_url: + socketio.emit('script_output', {'line': '⚠️ 未設定資料API URL,跳過POST請求'}) + return + + # 檢查是否有 API Token + api_token = config.get('api_token', '') + if not api_token: + socketio.emit('script_output', {'line': '⚠️ 未設定 API Token,跳過POST請求'}) + return + + # 構建 POST 請求的 URL + post_url = f"{api_url}/nfc/insertForProduction" + + # 準備 JSON 資料 + json_data = { + 'uid': uid, + 'ctr': sdm_ctr, + 'key': key_index + } + + # 準備請求標頭,包含 API Token + headers = { + 'Authorization': f'Bearer {api_token}', + 'Content-Type': 'application/json' + } + + socketio.emit('script_output', {'line': f'🔄 正在發送資料到 API: {post_url}'}) + socketio.emit('script_output', {'line': f'JSON 資料: {json.dumps(json_data, ensure_ascii=False)}'}) + socketio.emit('script_output', {'line': f'🔐 使用 API Token: {api_token[:20]}...'}) + + try: + # 發送 POST 請求,包含 API Token + response = requests.post(post_url, json=json_data, headers=headers, timeout=30) + + socketio.emit('script_output', {'line': f'📡 API 回應狀態碼: {response.status_code}'}) + + if response.status_code == 200: + socketio.emit('script_output', {'line': '✅ 資料成功發送到 API'}) + try: + # 檢查回應內容是否為空 + if response.text and response.text.strip(): + response_data = response.json() + socketio.emit('script_output', {'line': f'📄 API 回應: {json.dumps(response_data, ensure_ascii=False)}'}) + else: + socketio.emit('script_output', {'line': '📄 API 回應: (空回應)'}) + except json.JSONDecodeError as e: + socketio.emit('script_output', {'line': f'📄 API 回應 (非JSON格式): {response.text}'}) + except Exception as e: + socketio.emit('script_output', {'line': f'📄 API 回應解析錯誤: {str(e)}'}) + socketio.emit('script_output', {'line': f'📄 原始回應: {response.text}'}) + elif response.status_code == 401: + socketio.emit('script_output', {'line': '❌ API 認證失敗,請檢查 API Token 是否正確'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + elif response.status_code == 500: + socketio.emit('script_output', {'line': '❌ 伺服器內部錯誤 (500)'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + else: + socketio.emit('script_output', {'line': f'❌ API 請求失敗,狀態碼: {response.status_code}'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + + except requests.exceptions.Timeout: + socketio.emit('script_output', {'line': '❌ API 請求超時'}) + except requests.exceptions.ConnectionError: + socketio.emit('script_output', {'line': '❌ 無法連接到 API 伺服器'}) + except Exception as e: + socketio.emit('script_output', {'line': f'❌ API 請求發生錯誤: {str(e)}'}) + +def verify_nfc(key_no, name=''): + keys_path = get_keys_path() + if not os.path.exists(keys_path): + socketio.emit('script_output', {'line': '找不到 keys.txt,無法認證'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + with open(keys_path, 'r', encoding='utf-8') as f: + keys = [line.strip() for line in f if line.strip()] + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + # 執行 CMAC 認證 + cmd = [f'./{exe_file}', 'verify', '--key', key_no] + output_lines, success = run_and_emit(cmd, exe_dir, success_keywords=['MAC 驗證成功'], stop_on_success=False) + + # 檢查本地認證結果 + if success: + socketio.emit('script_output', {'line': f'✅ 本地 CMAC 認證成功!'}) + + # 解析結果 + uid, sdm_ctr, cmac, key_value = parse_verify_output(output_lines, key_no, keys) + + if uid and sdm_ctr and cmac: + socketio.emit('script_output', {'line': f'UID: {uid}'}) + socketio.emit('script_output', {'line': f'SDM 讀取計數器: {sdm_ctr}'}) + socketio.emit('script_output', {'line': f'ASCII MAC 資料: {cmac}'}) + + # 進行遠端認證 + verify_remote(uid, sdm_ctr, cmac, key_no) + else: + socketio.emit('script_output', {'line': '❌ 無法解析認證結果'}) + else: + # 檢查是否有 MAC 驗證失敗的錯誤碼 + mac_failed = False + for line in output_lines: + if 'MAC 驗證失敗' in line and '0x' in line: + socketio.emit('script_output', {'line': f'❌ 本地 CMAC 認證失敗: {line.strip()}'}) + mac_failed = True + break + + if not mac_failed: + socketio.emit('script_output', {'line': '❌ 本地 CMAC 認證失敗'}) + + socketio.emit('script_finished', {'message': 'CMAC 認證流程結束'}) + +def verify_remote(uid, sdm_ctr, cmac, key_no): + """進行遠端 CMAC 認證""" + verify_url = f"https://verify.contree.app/verify?uid={uid}&ctr={sdm_ctr}&cmac={cmac}&key={key_no}" + + socketio.emit('script_output', {'line': '🔄 開始遠端認證...'}) + socketio.emit('script_output', {'line': f'認證 URL: {verify_url}'}) + + try: + # 發送 GET 請求到遠端認證服務 + response = requests.get(verify_url, timeout=30) + + socketio.emit('script_output', {'line': f'📡 遠端認證回應狀態碼: {response.status_code}'}) + + if response.status_code == 200: + try: + # 檢查回應內容是否為空 + if response.text and response.text.strip(): + response_data = response.json() + + if response_data.get('success') == True: + socketio.emit('script_output', {'line': '✅ 線上認證成功!'}) + socketio.emit('script_output', {'line': f'📄 認證訊息: {response_data.get("message", "")}'}) + socketio.emit('script_output', {'line': f'📄 認證時間: {response_data.get("timestamp", "")}'}) + + # 顯示詳細資訊 + details = response_data.get('details', {}) + if details: + socketio.emit('script_output', {'line': f'📄 認證詳情:'}) + socketio.emit('script_output', {'line': f' UID: {details.get("uid", "")}'}) + socketio.emit('script_output', {'line': f' 計數器: {details.get("counter", "")}'}) + socketio.emit('script_output', {'line': f' CMAC: {details.get("cmac", "")}'}) + socketio.emit('script_output', {'line': f' 金鑰索引: {details.get("key_index", "")}'}) + else: + socketio.emit('script_output', {'line': '❌ 線上認證失敗'}) + socketio.emit('script_output', {'line': f'📄 錯誤訊息: {response_data.get("message", "")}'}) + else: + socketio.emit('script_output', {'line': '📄 遠端認證回應: (空回應)'}) + except json.JSONDecodeError as e: + socketio.emit('script_output', {'line': f'📄 遠端認證回應 (非JSON格式): {response.text}'}) + except Exception as e: + socketio.emit('script_output', {'line': f'📄 遠端認證回應解析錯誤: {str(e)}'}) + socketio.emit('script_output', {'line': f'📄 原始回應: {response.text}'}) + else: + socketio.emit('script_output', {'line': f'❌ 遠端認證請求失敗,狀態碼: {response.status_code}'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + + except requests.exceptions.Timeout: + socketio.emit('script_output', {'line': '❌ 遠端認證請求超時'}) + except requests.exceptions.ConnectionError: + socketio.emit('script_output', {'line': '❌ 無法連接到遠端認證服務'}) + except Exception as e: + socketio.emit('script_output', {'line': f'❌ 遠端認證發生錯誤: {str(e)}'}) + +def post_to_verify_api(uid, name=''): + """將 UID POST 到資料 API 進行檢驗""" + api_url = config.get('api_url', '') + if not api_url: + socketio.emit('script_output', {'line': '⚠️ 未設定資料API URL,跳過POST請求'}) + return + + # 檢查是否有 API Token + api_token = config.get('api_token', '') + if not api_token: + socketio.emit('script_output', {'line': '⚠️ 未設定 API Token,跳過POST請求'}) + return + + # 構建 POST 請求的 URL + post_url = f"{api_url}/nfc/verifyForProduction" + + # 準備 JSON 資料 + json_data = { + 'uid': uid + } + + # 準備請求標頭,包含 API Token + headers = { + 'Authorization': f'Bearer {api_token}', + 'Content-Type': 'application/json' + } + + socketio.emit('script_output', {'line': f'🔄 正在發送檢驗資料到 API: {post_url}'}) + socketio.emit('script_output', {'line': f'JSON 資料: {json.dumps(json_data, ensure_ascii=False)}'}) + socketio.emit('script_output', {'line': f'🔐 使用 API Token: {api_token[:20]}...'}) + + try: + # 發送 POST 請求,包含 API Token + response = requests.post(post_url, json=json_data, headers=headers, timeout=30) + + socketio.emit('script_output', {'line': f'📡 API 回應狀態碼: {response.status_code}'}) + + if response.status_code == 200: + socketio.emit('script_output', {'line': '✅ 檢驗資料成功發送到 API'}) + try: + # 檢查回應內容是否為空 + if response.text and response.text.strip(): + response_data = response.json() + socketio.emit('script_output', {'line': f'📄 API 回應: {json.dumps(response_data, ensure_ascii=False)}'}) + else: + socketio.emit('script_output', {'line': '📄 API 回應: (空回應)'}) + except json.JSONDecodeError as e: + socketio.emit('script_output', {'line': f'📄 API 回應 (非JSON格式): {response.text}'}) + except Exception as e: + socketio.emit('script_output', {'line': f'📄 API 回應解析錯誤: {str(e)}'}) + socketio.emit('script_output', {'line': f'📄 原始回應: {response.text}'}) + elif response.status_code == 401: + socketio.emit('script_output', {'line': '❌ API 認證失敗,請檢查 API Token 是否正確'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + elif response.status_code == 500: + socketio.emit('script_output', {'line': '❌ 伺服器內部錯誤 (500)'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + else: + socketio.emit('script_output', {'line': f'❌ API 請求失敗,狀態碼: {response.status_code}'}) + socketio.emit('script_output', {'line': f'📄 錯誤回應: {response.text if response.text else "(空回應)"}'}) + + except requests.exceptions.Timeout: + socketio.emit('script_output', {'line': '❌ API 請求超時'}) + except requests.exceptions.ConnectionError: + socketio.emit('script_output', {'line': '❌ 無法連接到 API 伺服器'}) + except Exception as e: + socketio.emit('script_output', {'line': f'❌ API 請求發生錯誤: {str(e)}'}) + + + + + + +# ------------------ 手動測試功能 ------------------ +@app.route('/manual_test') +def manual_test_page(): + return render_template('manual_test.html') + +@app.route('/api/manual_verify', methods=['POST']) +def api_manual_verify(): + """手動驗證 API""" + data = request.get_json() + uid = data.get('uid', '').strip() + ctr = data.get('ctr', '').strip() + cmac = data.get('cmac', '').strip() + key_index = data.get('key_index', '').strip() + url_index = data.get('url_index', '').strip() + full_url = data.get('full_url', '').strip() + quiet_mode = data.get('quiet_mode', False) + + if not uid or not ctr or not cmac: + return jsonify({'success': False, 'message': 'UID、計數器和 CMAC 為必填欄位'}), 400 + + thread = threading.Thread(target=run_manual_verify, args=(uid, ctr, cmac, key_index, url_index, full_url, quiet_mode)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始手動驗證流程'}) + +def run_manual_verify(uid, ctr, cmac, key_index, url_index, full_url, quiet_mode): + """執行手動驗證""" + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + cmd = [f'./{exe_file}', 'verify', '--manual', '--uid', uid, '--ctr', ctr, '--cmac', cmac] + + if key_index: + cmd.extend(['--key', key_index]) + if url_index: + cmd.extend(['--url-index', url_index]) + if full_url: + cmd = [f'./{exe_file}', 'verify', '--manual', '--url', full_url] + if key_index: + cmd.extend(['--key', key_index]) + if quiet_mode: + cmd.append('--quiet') + + socketio.emit('script_output', {'line': f'執行手動驗證: {" ".join(cmd)}'}) + output_lines, success = run_and_emit(cmd, exe_dir) + socketio.emit('script_finished', {'message': '手動驗證完成'}) + +@app.route('/api/manual_getuid', methods=['POST']) +def api_manual_getuid(): + """手動讀取 UID API""" + data = request.get_json() + key_index = data.get('key_index', '').strip() + quiet_mode = data.get('quiet_mode', False) + + thread = threading.Thread(target=run_manual_getuid, args=(key_index, quiet_mode)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始讀取 UID 流程'}) + +def run_manual_getuid(key_index, quiet_mode): + """執行手動讀取 UID""" + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + cmd = [f'./{exe_file}', 'getuid'] + if key_index: + cmd.extend(['--key', key_index]) + if quiet_mode: + cmd.append('--quiet') + + socketio.emit('script_output', {'line': f'執行讀取 UID: {" ".join(cmd)}'}) + output_lines, success = run_and_emit(cmd, exe_dir) + socketio.emit('script_finished', {'message': '讀取 UID 完成'}) + +@app.route('/api/manual_setsdm', methods=['POST']) +def api_manual_setsdm(): + """手動設定 SDM API""" + data = request.get_json() + url_index = data.get('url_index', '').strip() + key_index = data.get('key_index', '').strip() + quiet_mode = data.get('quiet_mode', False) + + if not url_index: + return jsonify({'success': False, 'message': 'URL 索引為必填欄位'}), 400 + + thread = threading.Thread(target=run_manual_setsdm, args=(url_index, key_index, quiet_mode)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始設定 SDM 流程'}) + +def run_manual_setsdm(url_index, key_index, quiet_mode): + """執行手動設定 SDM""" + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + cmd = [f'./{exe_file}', 'setsdm', '--url', url_index] + if key_index: + cmd.extend(['--key', key_index]) + if quiet_mode: + cmd.append('--quiet') + + socketio.emit('script_output', {'line': f'執行設定 SDM: {" ".join(cmd)}'}) + output_lines, success = run_and_emit(cmd, exe_dir) + socketio.emit('script_finished', {'message': '設定 SDM 完成'}) + +@app.route('/api/manual_changekey', methods=['POST']) +def api_manual_changekey(): + """手動變更金鑰 API""" + data = request.get_json() + auth_key = data.get('auth_key', '').strip() + new_key = data.get('new_key', '').strip() + old_key = data.get('old_key', '').strip() + key_no = data.get('key_no', '0').strip() + quiet_mode = data.get('quiet_mode', False) + + if not auth_key or not new_key or not old_key: + return jsonify({'success': False, 'message': '認證金鑰、新金鑰和舊金鑰為必填欄位'}), 400 + + thread = threading.Thread(target=run_manual_changekey, args=(auth_key, new_key, old_key, key_no, quiet_mode)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始變更金鑰流程'}) + +def run_manual_changekey(auth_key, new_key, old_key, key_no, quiet_mode): + """執行手動變更金鑰""" + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + cmd = [f'./{exe_file}', 'changekey', '--auth-key', auth_key, '--new-key', new_key, '--old-key', old_key, '--key-no', key_no] + if quiet_mode: + cmd.append('--quiet') + + socketio.emit('script_output', {'line': f'執行變更金鑰: {" ".join(cmd)}'}) + output_lines, success = run_and_emit(cmd, exe_dir) + socketio.emit('script_finished', {'message': '變更金鑰完成'}) + +@app.route('/api/manual_writendef', methods=['POST']) +def api_manual_writendef(): + """手動寫入 NDEF API""" + data = request.get_json() + url_index = data.get('url_index', '').strip() + + if not url_index: + return jsonify({'success': False, 'message': 'URL 索引為必填欄位'}), 400 + + thread = threading.Thread(target=run_manual_writendef, args=(url_index,)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始寫入 NDEF 流程'}) + +def run_manual_writendef(url_index): + """執行手動寫入 NDEF""" + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + cmd = [f'./{exe_file}', 'writendef', '--url-index', url_index] + + socketio.emit('script_output', {'line': f'執行寫入 NDEF: {" ".join(cmd)}'}) + output_lines, success = run_and_emit(cmd, exe_dir) + socketio.emit('script_finished', {'message': '寫入 NDEF 完成'}) + +@app.route('/api/manual_readndef', methods=['POST']) +def api_manual_readndef(): + """手動讀取 NDEF API""" + thread = threading.Thread(target=run_manual_readndef) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始讀取 NDEF 流程'}) + +def run_manual_readndef(): + """執行手動讀取 NDEF""" + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + cmd = [f'./{exe_file}', 'readndef'] + + socketio.emit('script_output', {'line': f'執行讀取 NDEF: {" ".join(cmd)}'}) + output_lines, success = run_and_emit(cmd, exe_dir) + socketio.emit('script_finished', {'message': '讀取 NDEF 完成'}) + +@app.route('/api/manual_custom_command', methods=['POST']) +def api_manual_custom_command(): + """手動自定義指令 API""" + data = request.get_json() + command = data.get('command', '').strip() + description = data.get('description', '').strip() + + if not command: + return jsonify({'success': False, 'message': '指令不得為空'}), 400 + + # 基本安全檢查:確保指令以 ./nt4h_c_example 開頭 + if not command.startswith('./nt4h_c_example'): + return jsonify({'success': False, 'message': '指令必須以 ./nt4h_c_example 開頭'}), 400 + + thread = threading.Thread(target=run_manual_custom_command, args=(command, description)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始執行自定義指令'}) + +def run_manual_custom_command(command, description=''): + """執行手動自定義指令""" + # 使用絕對路徑 + exe_dir = abspath('linux64_release') + + # 解析指令 + cmd_parts = command.split() + + # 移除開頭的 ./nt4h_c_example,使用完整路徑 + if cmd_parts[0] == './nt4h_c_example': + cmd_parts[0] = abspath('linux64_release/nt4h_c_example') + else: + # 如果不是以 ./nt4h_c_example 開頭,直接使用完整路徑 + cmd_parts[0] = abspath('linux64_release/nt4h_c_example') + + socketio.emit('script_output', {'line': f'執行自定義指令: {" ".join(cmd_parts)}'}) + if description: + socketio.emit('script_output', {'line': f'指令說明: {description}'}) + + output_lines, success = run_and_emit(cmd_parts, exe_dir) + socketio.emit('script_finished', {'message': '自定義指令執行完成'}) + +@app.route('/api/check_nfc', methods=['POST']) +def api_check_nfc(): + """檢驗 NFC API""" + data = request.get_json() + key = data.get('key') + name = data.get('name', '') + if not key: + return jsonify({'success': False, 'message': '未選擇 key'}), 400 + + # 儲存名稱到 config + if name: + config['name'] = name + save_config(config) + + thread = threading.Thread(target=run_check_nfc, args=(key, name)) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始檢驗 NFC 流程'}) + +def run_check_nfc(key_no, name=''): + """執行檢驗 NFC""" + keys_path = get_keys_path() + if not os.path.exists(keys_path): + socketio.emit('script_output', {'line': '找不到 keys.txt,無法檢驗NFC'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + with open(keys_path, 'r', encoding='utf-8') as f: + keys = [line.strip() for line in f if line.strip()] + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + + # 執行本地 CMAC 認證 + socketio.emit('script_output', {'line': '🔍 開始檢驗 NFC...'}) + cmd = [f'./{exe_file}', 'verify', '--key', key_no] + output_lines, success = run_and_emit(cmd, exe_dir, success_keywords=['MAC 驗證成功'], stop_on_success=False) + + # 檢查本地認證結果 + if success: + socketio.emit('script_output', {'line': f'✅ 本地 CMAC 認證成功!'}) + + # 解析結果 + uid, sdm_ctr, cmac, key_value = parse_verify_output(output_lines, key_no, keys) + + if uid: + socketio.emit('script_output', {'line': f'UID: {uid}'}) + socketio.emit('script_output', {'line': f'SDM 讀取計數器: {sdm_ctr}'}) + socketio.emit('script_output', {'line': f'ASCII MAC 資料: {cmac}'}) + + # POST 到資料 API + post_to_verify_api(uid, name) + else: + socketio.emit('script_output', {'line': '❌ 無法解析 UID'}) + else: + # 檢查是否有 MAC 驗證失敗的錯誤碼 + mac_failed = False + for line in output_lines: + if 'MAC 驗證失敗' in line and '0x' in line: + socketio.emit('script_output', {'line': f'❌ 本地 CMAC 認證失敗: {line.strip()}'}) + mac_failed = True + break + + if not mac_failed: + socketio.emit('script_output', {'line': '❌ 本地 CMAC 認證失敗'}) + + socketio.emit('script_finished', {'message': '檢驗 NFC 流程結束'}) + +@app.route('/api/test_nfc', methods=['POST']) +def api_test_nfc(): + """完整測試 NFC API""" + thread = threading.Thread(target=run_test_nfc) + thread.daemon = True + thread.start() + return jsonify({'success': True, 'message': '開始完整測試 NFC 流程'}) + +def run_test_nfc(): + """執行完整測試 NFC""" + keys_path = get_keys_path() + if not os.path.exists(keys_path): + socketio.emit('script_output', {'line': '找不到 keys.txt,無法執行完整測試'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + with open(keys_path, 'r', encoding='utf-8') as f: + keys = [line.strip() for line in f if line.strip()] + exe_dir = dirname(abspath(nt4h_exe_path)) + exe_file = basename(nt4h_exe_path) + test_script_path = os.path.join(exe_dir, 'test_ntag424.sh') + + socketio.emit('script_output', {'line': '🔍 開始完整測試 NFC 功能...'}) + + # 步驟1: 讀取UID找到可用的KEY + socketio.emit('script_output', {'line': '🔄 步驟1: 讀取UID尋找可用KEY...'}) + oldkey, _ = find_valid_oldkey(keys, exe_file, exe_dir) + if not oldkey: + socketio.emit('script_output', {'line': '❌ 未找到可用的 oldkey,無法執行完整測試'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + + socketio.emit('script_output', {'line': f'✅ 找到可用 oldkey:第{oldkey}行'}) + + # 步驟2: 強制更換到key 1 + socketio.emit('script_output', {'line': '🔄 步驟2: 強制更換到key 1...'}) + cmd = [f'./{exe_file}', 'changekey', '--auth-key', oldkey, '--new-key', '1', '--old-key', oldkey, '--key-no', '0'] + output_lines, success = run_and_emit(cmd, exe_dir, success_keywords=['成功變更金鑰', '金鑰變更完成'], stop_on_success=False) + + if not success: + socketio.emit('script_output', {'line': '❌ 強制更換到key 1失敗,無法執行完整測試'}) + socketio.emit('script_finished', {'message': '流程結束'}) + return + + socketio.emit('script_output', {'line': '✅ 成功強制更換到key 1!'}) + + # 步驟3: 執行測試腳本 + if os.path.exists(test_script_path): + socketio.emit('script_output', {'line': '🔄 步驟3: 執行完整測試腳本...'}) + socketio.emit('script_output', {'line': f'測試腳本路徑: {test_script_path}'}) + + # 執行測試腳本 + test_cmd = ['bash', test_script_path] + test_output_lines, test_success = run_and_emit(test_cmd, exe_dir, success_keywords=['🎉 所有測試都通過了!']) + + if test_success: + socketio.emit('script_output', {'line': '✅ NFC 完整測試完成!所有測試都通過了!'}) + else: + socketio.emit('script_output', {'line': '⚠️ NFC 完整測試完成,但可能有問題'}) + else: + socketio.emit('script_output', {'line': '❌ 找不到 test_ntag424.sh 測試腳本'}) + socketio.emit('script_output', {'line': f'預期路徑: {test_script_path}'}) + + socketio.emit('script_finished', {'message': 'NFC 完整測試完成'}) + +@socketio.on('connect') +def ws_connect(): + print(f"WebSocket 客戶端已連接: {request.sid}") + emit('connected', {'message': '已連接到伺服器'}) + +@socketio.on('disconnect') +def ws_disconnect(): + print(f"WebSocket 客戶端已斷開: {request.sid}") + +@socketio.on('error') +def ws_error(error): + print(f"WebSocket 錯誤: {error}") + +if __name__ == '__main__': + print("NFC 生產工具與腳本執行監控整合版") + print("=" * 50) + #print(f"預設腳本路徑: {script_path}") + print("啟動網頁伺服器...") + print("請在瀏覽器中開啟: http://localhost:5000") + print("按 Ctrl+C 停止伺服器") + print("=" * 50) + socketio.run(app, host='0.0.0.0', port=5000, debug=False) \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..4db479b --- /dev/null +++ b/config.json @@ -0,0 +1,6 @@ +{ + "api_url": "https://isim.digitalent.cc/gsct", + "api_token": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NTgwNzI5MzAsInVzZXJJZCI6Mn0.zp3gwqRTVAdh01kSVgO6LBvrEM6teQ8vprK7ayE-MKc", + "name": "", + "names": [] +} diff --git a/deploy_arm.sh b/deploy_arm.sh new file mode 100644 index 0000000..d1fbac4 --- /dev/null +++ b/deploy_arm.sh @@ -0,0 +1,227 @@ +#!/bin/bash + +# NTAG424 ARM 部署腳本 +# 支援動態連結版本的自動部署 + +set -e + +TARGET_HOST="$1" +TARGET_USER="$2" +ARM_ARCH="$3" + +if [[ -z "$TARGET_HOST" || -z "$TARGET_USER" || -z "$ARM_ARCH" ]]; then + echo "🚀 NTAG424 ARM 部署腳本" + echo "========================" + echo "" + echo "用法: ./deploy_arm.sh <主機> <使用者> <架構>" + echo "" + echo "架構選項:" + echo " arm64 - ARM 64-bit (aarch64)" + echo " arm32 - ARM 32-bit (armhf)" + echo " armel - ARM 軟浮點" + echo "" + echo "範例:" + echo " ./deploy_arm.sh 192.168.1.100 pi arm64" + echo " ./deploy_arm.sh raspberry.local user arm32" + exit 1 +fi + +echo "🚀 NTAG424 ARM 部署腳本" +echo "========================" +echo "" +echo "目標主機: $TARGET_HOST" +echo "使用者: $TARGET_USER" +echo "架構: $ARM_ARCH" +echo "" + +# 設定函式庫目錄和發布目錄 +case "$ARM_ARCH" in + "arm64") + LIB_DIR="ufr-lib/linux/aarch64" + RELEASE_DIR="${ARM_ARCH}_release" + LIB_NAME="libuFCoder-aarch64.so" + ;; + "arm32") + LIB_DIR="ufr-lib/linux/arm-hf" + RELEASE_DIR="${ARM_ARCH}_release" + LIB_NAME="libuFCoder-armhf.so" + ;; + "armel") + LIB_DIR="ufr-lib/linux/arm-el" + RELEASE_DIR="${ARM_ARCH}_release" + LIB_NAME="libuFCoder-armel.so" + ;; + *) + echo "❌ 不支援的架構: $ARM_ARCH" + echo "支援的架構: arm64, arm32, armel" + exit 1 + ;; +esac + +# 檢查本地檔案 +echo "📋 檢查本地檔案..." + +if [[ ! -d "$LIB_DIR" ]]; then + echo "❌ 函式庫目錄不存在: $LIB_DIR" + exit 1 +fi + +if [[ ! -f "$LIB_DIR/$LIB_NAME" ]]; then + echo "❌ 函式庫檔案不存在: $LIB_DIR/$LIB_NAME" + exit 1 +fi + +if [[ ! -d "$RELEASE_DIR" ]]; then + echo "⚠️ 發布目錄不存在: $RELEASE_DIR" + echo "正在編譯 $ARM_ARCH 版本..." + make $ARM_ARCH +fi + +if [[ ! -f "$RELEASE_DIR/nt4h_c_example" ]]; then + echo "❌ 執行檔不存在: $RELEASE_DIR/nt4h_c_example" + echo "請先編譯: make $ARM_ARCH" + exit 1 +fi + +echo "✅ 本地檔案檢查完成" +echo "" + +# 檢查目標主機連接 +echo "🔗 檢查目標主機連接..." +if ! ssh -o ConnectTimeout=5 ${TARGET_USER}@${TARGET_HOST} 'echo "連接成功"' >/dev/null 2>&1; then + echo "❌ 無法連接到 ${TARGET_USER}@${TARGET_HOST}" + echo "請檢查:" + echo "• 主機名稱或 IP 是否正確" + echo "• SSH 金鑰是否已設定" + echo "• 目標設備是否開機並連接網路" + exit 1 +fi + +echo "✅ 目標主機連接正常" +echo "" + +# 檢查目標架構 +echo "🎯 檢查目標設備架構..." +TARGET_ARCH=$(ssh ${TARGET_USER}@${TARGET_HOST} 'uname -m') +echo "目標設備架構: $TARGET_ARCH" + +case "$ARM_ARCH" in + "arm64") + if [[ "$TARGET_ARCH" != "aarch64" ]]; then + echo "⚠️ 架構不匹配!編譯目標 $ARM_ARCH,但設備是 $TARGET_ARCH" + read -p "是否繼續部署? [y/N]: " continue_deploy + if [[ "$continue_deploy" != "y" && "$continue_deploy" != "Y" ]]; then + echo "取消部署" + exit 1 + fi + fi + ;; + "arm32") + if [[ "$TARGET_ARCH" != "armv7l" && "$TARGET_ARCH" != "armv6l" ]]; then + echo "⚠️ 架構不匹配!編譯目標 $ARM_ARCH,但設備是 $TARGET_ARCH" + read -p "是否繼續部署? [y/N]: " continue_deploy + if [[ "$continue_deploy" != "y" && "$continue_deploy" != "Y" ]]; then + echo "取消部署" + exit 1 + fi + fi + ;; +esac + +echo "" + +# 部署檔案 +echo "📦 部署檔案到目標設備..." + +echo "• 上傳執行檔..." +scp ${RELEASE_DIR}/nt4h_c_example ${TARGET_USER}@${TARGET_HOST}:/home/${TARGET_USER}/ + +echo "• 上傳函式庫..." +ssh ${TARGET_USER}@${TARGET_HOST} 'mkdir -p ufr-lib' +scp -r ${LIB_DIR}/* ${TARGET_USER}@${TARGET_HOST}:/home/${TARGET_USER}/ufr-lib/ + +echo "• 上傳配置檔案..." +if [[ -f "keys.txt" ]]; then + scp keys.txt ${TARGET_USER}@${TARGET_HOST}:/home/${TARGET_USER}/ + echo " ✅ keys.txt" +else + echo " ⚠️ keys.txt 不存在,跳過" +fi + +if [[ -f "urls.txt" ]]; then + scp urls.txt ${TARGET_USER}@${TARGET_HOST}:/home/${TARGET_USER}/ + echo " ✅ urls.txt" +else + echo " ⚠️ urls.txt 不存在,跳過" +fi + +echo "" + +# 建立啟動腳本 +echo "📝 建立啟動腳本..." +ssh ${TARGET_USER}@${TARGET_HOST} 'cat > run_ntag424.sh << "EOF" +#!/bin/bash +# NTAG424 啟動腳本 - 自動設定函式庫路徑 + +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" +export LD_LIBRARY_PATH="$SCRIPT_DIR/ufr-lib:$LD_LIBRARY_PATH" + +# 檢查函式庫 +if [[ ! -f "$SCRIPT_DIR/ufr-lib/libuFCoder-"*".so" ]]; then + echo "❌ 找不到 uFCoder 函式庫" + echo "請確認 ufr-lib 目錄存在並包含正確的 .so 檔案" + exit 1 +fi + +# 執行主程式 +"$SCRIPT_DIR/nt4h_c_example" "$@" +EOF' + +echo "✅ 啟動腳本建立完成" +echo "" + +# 設定權限 +echo "🔐 設定執行權限..." +ssh ${TARGET_USER}@${TARGET_HOST} 'chmod +x nt4h_c_example run_ntag424.sh' + +echo "✅ 權限設定完成" +echo "" + +# 測試部署 +echo "🧪 測試部署..." +echo "執行測試命令: ./run_ntag424.sh help" +echo "" + +if ssh ${TARGET_USER}@${TARGET_HOST} './run_ntag424.sh help' 2>/dev/null; then + echo "" + echo "🎉 部署成功!" + echo "" + echo "📋 部署總結:" + echo "• 執行檔: ~/nt4h_c_example" + echo "• 函式庫: ~/ufr-lib/" + echo "• 啟動腳本: ~/run_ntag424.sh (推薦使用)" + echo "• 配置檔案: ~/keys.txt, ~/urls.txt" + echo "" + echo "🚀 使用方法:" + echo "ssh ${TARGET_USER}@${TARGET_HOST}" + echo "./run_ntag424.sh help" + echo "./run_ntag424.sh verify" + echo "./run_ntag424.sh setsdm" + echo "" +else + echo "" + echo "⚠️ 測試執行失敗,但檔案已部署" + echo "" + echo "可能的問題:" + echo "• 架構不相容" + echo "• 缺少依賴函式庫" + echo "• 權限問題" + echo "" + echo "手動測試:" + echo "ssh ${TARGET_USER}@${TARGET_HOST}" + echo "export LD_LIBRARY_PATH=~/ufr-lib:\$LD_LIBRARY_PATH" + echo "./nt4h_c_example help" +fi + +echo "" +echo "📞 如需技術支援,請參考 ARM_BUILD_GUIDE.md" \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..e7e65eb --- /dev/null +++ b/install.sh @@ -0,0 +1,264 @@ +#!/bin/bash + +# NFC 生產工具 - Linux 安裝腳本 +# 適用於 Ubuntu/Debian/CentOS/RHEL + +set -e + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# 日誌函數 +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# 檢測作業系統 +detect_os() { + if [[ -f /etc/os-release ]]; then + . /etc/os-release + OS=$NAME + VER=$VERSION_ID + else + log_error "無法檢測作業系統" + exit 1 + fi + + log_info "檢測到作業系統: $OS $VER" +} + +# 安裝系統依賴 +install_system_deps() { + log_info "安裝系統依賴套件..." + + case $OS in + *"Ubuntu"*|*"Debian"*) + sudo apt update + sudo apt install -y python3 python3-pip python3-venv gcc make curl wget + ;; + *"CentOS"*|*"Red Hat"*|*"Rocky"*|*"AlmaLinux"*) + sudo yum update -y + sudo yum install -y python3 python3-pip gcc make curl wget + ;; + *) + log_error "不支援的作業系統: $OS" + exit 1 + ;; + esac + + log_success "系統依賴安裝完成" +} + +# 設定 USB 權限 +setup_usb_permissions() { + log_info "設定 USB 裝置權限..." + + # 創建 udev 規則 + sudo tee /etc/udev/rules.d/99-ufr.rules << EOF +# uFR NFC 讀卡機權限規則 +SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666" +SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="0666" +SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0666" +EOF + + # 重新載入 udev 規則 + sudo udevadm control --reload-rules + sudo udevadm trigger + + # 將使用者加入 dialout 群組 + if ! groups $USER | grep -q dialout; then + sudo usermod -a -G dialout $USER + log_info "已將使用者 $USER 加入 dialout 群組" + log_warning "請重新登入以套用群組變更" + fi + + log_success "USB 權限設定完成" +} + +# 設定 Python 虛擬環境 +setup_python_env() { + log_info "設定 Python 虛擬環境..." + + # 檢查 Python 版本 + if ! python3 -c "import sys; exit(0 if sys.version_info >= (3, 7) else 1)" 2>/dev/null; then + log_error "需要 Python 3.7 或以上版本" + exit 1 + fi + + # 如果虛擬環境已存在但損壞,先刪除 + if [[ -d "myenv" ]]; then + log_warning "發現現有虛擬環境,正在重新創建..." + rm -rf myenv + fi + + # 創建虛擬環境 + python3 -m venv myenv + log_success "Python 虛擬環境創建完成" + + # 啟動虛擬環境並安裝依賴 + source myenv/bin/activate + + # 確保 pip 是最新版本 + log_info "升級 pip..." + python -m pip install --upgrade pip + + # 安裝依賴套件 + log_info "安裝 Python 套件..." + pip install -r requirements.txt + + log_success "Python 環境設定完成" +} + +# 設定檔案權限 +setup_file_permissions() { + log_info "設定檔案權限..." + + # 設定執行權限 + chmod +x start.sh + chmod +x install.sh + + if [[ -f "linux64_release/nt4h_c_example" ]]; then + chmod +x linux64_release/nt4h_c_example + fi + + if [[ -f "linux64_release/libnt4h_c.so" ]]; then + chmod +x linux64_release/libnt4h_c.so + fi + + # 設定設定檔權限 + if [[ -f "linux64_release/keys.txt" ]]; then + chmod 666 linux64_release/keys.txt + fi + + if [[ -f "linux64_release/urls.txt" ]]; then + chmod 666 linux64_release/urls.txt + fi + + log_success "檔案權限設定完成" +} + +# 創建 systemd 服務(可選) +create_systemd_service() { + # 檢查並刪除現有的 NFCapp.service + if [[ -f "/etc/systemd/system/NFCapp.service" ]]; then + log_warning "發現現有的 NFCapp.service,正在刪除..." + sudo systemctl stop NFCapp.service 2>/dev/null || true + sudo systemctl disable NFCapp.service 2>/dev/null || true + sudo rm -f /etc/systemd/system/NFCapp.service + sudo systemctl daemon-reload + log_success "現有的 NFCapp.service 已刪除" + fi + + read -p "是否要創建 systemd 服務?(y/N): " -n 1 -r + echo + + if [[ $REPLY =~ ^[Yy]$ ]]; then + log_info "創建 systemd 服務..." + + # 獲取當前目錄的絕對路徑 + CURRENT_DIR=$(pwd) + + sudo tee /etc/systemd/system/NFCapp.service << EOF +[Unit] +Description=NFC App +After=network.target + +[Service] +Type=simple +User=digitalent +WorkingDirectory=/home/digitalent/ufr_zero +ExecStart=/home/digitalent/ufr_zero/myenv/bin/python /home/digitalent/ufr_zero/app.py +Restart=always + +[Install] +WantedBy=multi-user.target +EOF + + # 重新載入 systemd + sudo systemctl daemon-reload + + log_success "systemd 服務創建完成" + log_info "使用以下命令管理服務:" + echo " 啟動服務: sudo systemctl start NFCapp.service" + echo " 停止服務: sudo systemctl stop NFCapp.service" + echo " 啟用開機自啟: sudo systemctl enable NFCapp.service" + echo " 查看狀態: sudo systemctl status NFCapp.service" + echo " 查看日誌: sudo journalctl -u NFCapp.service -f" + fi +} + +# 顯示安裝完成資訊 +show_completion_info() { + echo + log_success "=== NFC 生產工具安裝完成 ===" + echo + log_info "安裝位置: $(pwd)" + log_info "Python 虛擬環境: myenv/" + echo + log_info "啟動方式:" + echo " 1. 直接啟動: ./start.sh" + echo " 2. 背景執行: nohup ./start.sh > app.log 2>&1 &" + echo " 3. systemd 服務: sudo systemctl start nfc-web.service" + echo + log_info "Web 介面: http://localhost:5000" + echo + log_info "重要提醒:" + echo " - 請確保 uFR NFC 讀卡機已正確連接" + echo " - 檢查 keys.txt 和 urls.txt 檔案內容" + echo " - 設定 API URL 以啟用資料庫上傳功能" + echo + log_warning "如果重新登入後仍有 USB 權限問題,請執行:" + echo " sudo udevadm control --reload-rules" + echo " sudo udevadm trigger" + echo +} + +# 主安裝流程 +main() { + echo "==========================================" + echo " NFC 生產工具 - Linux 安裝腳本" + echo "==========================================" + echo + + # 檢查是否為 root 使用者 + if [[ $EUID -eq 0 ]]; then + log_error "請勿使用 root 使用者執行此腳本" + exit 1 + fi + + # 檢查必要檔案 + if [[ ! -f "app.py" ]] || [[ ! -f "requirements.txt" ]]; then + log_error "請在專案根目錄執行此腳本" + exit 1 + fi + + # 執行安裝步驟 + detect_os + install_system_deps + setup_usb_permissions + setup_python_env + setup_file_permissions + create_systemd_service + + # 顯示完成資訊 + show_completion_info +} + +# 執行主函數 +main "$@" diff --git a/install_arm_tools.sh b/install_arm_tools.sh new file mode 100644 index 0000000..4030f70 --- /dev/null +++ b/install_arm_tools.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# ARM 交叉編譯工具安裝腳本 +# 支援 Ubuntu/Debian 系統 + +set -e + +echo "🔧 NTAG424 ARM 交叉編譯工具安裝腳本" +echo "========================================" +echo "" + +# 檢查系統類型 +if [[ -f /etc/debian_version ]]; then + DISTRO="debian" + echo "檢測到 Debian/Ubuntu 系統" +elif [[ -f /etc/redhat-release ]]; then + DISTRO="redhat" + echo "檢測到 RedHat/CentOS 系統" +else + echo "❌ 不支援的系統類型" + echo "請手動安裝 ARM 交叉編譯工具" + exit 1 +fi + +echo "" +echo "將安裝以下交叉編譯工具:" +echo "- gcc-aarch64-linux-gnu (ARM 64-bit)" +echo "- gcc-arm-linux-gnueabihf (ARM 32-bit 硬浮點)" +echo "- gcc-arm-linux-gnueabi (ARM 32-bit 軟浮點)" +echo "" + +read -p "繼續安裝? [y/N]: " confirm +if [[ "$confirm" != "y" && "$confirm" != "Y" ]]; then + echo "取消安裝" + exit 0 +fi + +echo "" +echo "🚀 開始安裝..." + +if [[ "$DISTRO" == "debian" ]]; then + echo "更新套件列表..." + sudo apt update + + echo "安裝 ARM 交叉編譯工具..." + sudo apt install -y \ + gcc-aarch64-linux-gnu \ + gcc-arm-linux-gnueabihf \ + gcc-arm-linux-gnueabi \ + build-essential + +elif [[ "$DISTRO" == "redhat" ]]; then + echo "安裝 EPEL repository..." + sudo yum install -y epel-release || sudo dnf install -y epel-release + + echo "安裝 ARM 交叉編譯工具..." + sudo yum install -y \ + gcc-aarch64-linux-gnu \ + gcc-arm-linux-gnu || \ + sudo dnf install -y \ + gcc-aarch64-linux-gnu \ + gcc-arm-linux-gnu +fi + +echo "" +echo "✅ 安裝完成!" +echo "" + +echo "🔍 驗證安裝..." +make check-cross-tools + +echo "" +echo "🎉 所有工具安裝成功!" +echo "" +echo "現在你可以使用以下命令編譯 ARM 版本:" +echo " make arm64 # ARM 64-bit 動態版本" +echo " make arm64-static # ARM 64-bit 靜態版本 (推薦)" +echo " make arm32 # ARM 32-bit 動態版本" +echo " make arm32-static # ARM 32-bit 靜態版本 (推薦)" +echo " make armel # ARM 軟浮點版本" +echo "" +echo "詳細說明請參考: ARM_BUILD_GUIDE.md" \ No newline at end of file diff --git a/linux64_release/API_DOCUMENTATION.md b/linux64_release/API_DOCUMENTATION.md new file mode 100644 index 0000000..a2d3784 --- /dev/null +++ b/linux64_release/API_DOCUMENTATION.md @@ -0,0 +1,328 @@ +# NTAG424 CMAC 驗證 API 文檔 + +## 概述 + +NTAG424 CMAC 驗證 API 是一個 HTTP 服務,提供 NTAG424 卡片的 CMAC(Cipher-based Message Authentication Code)驗證功能。這個 API 允許遠端驗證 NTAG424 卡片的真實性,無需直接存取讀卡機硬體。 + +## 功能特點 + +- ✅ **純軟體驗證**:無需讀卡機硬體,僅需 UID、計數器、CMAC 和金鑰索引 +- ✅ **HTTP RESTful API**:標準 HTTP GET 請求,易於整合 +- ✅ **JSON 回應格式**:結構化資料回應,易於程式處理 +- ✅ **多金鑰支援**:支援 1-10 個不同的 AES 金鑰 +- ✅ **CORS 支援**:跨域請求支援,適合 Web 應用程式 +- ✅ **詳細錯誤處理**:提供清晰的錯誤訊息和狀態碼 +- ✅ **多執行緒支援**:同時處理多個請求 + +## 快速開始 + +### 1. 啟動服務器 + +```bash +# 使用預設端口 8080 +./cmac_api_server + +# 或指定自訂端口 +./cmac_api_server 8888 +``` + +### 2. 基本驗證請求 + +```bash +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" +``` + +## API 端點 + +### 1. `/verify` - CMAC 驗證 + +**方法**: `GET` +**用途**: 驗證 NTAG424 卡片的 CMAC + +#### 查詢參數 + +| 參數 | 類型 | 必填 | 說明 | 範例 | +|--------|--------|------|----------------------------------------------|--------------------| +| `uid` | string | ✅ | 卡片 UID (14 位十六進位字元) | `0456735AD51F90` | +| `ctr` | string | ✅ | SDM 讀取計數器 (6 位十六進位字元) | `000028` | +| `cmac` | string | ✅ | CMAC 值 (16 位十六進位字元) | `222ED1BA962F7F5C` | +| `key` | int | ✅ | 金鑰索引 (1-10) | `1` | + +#### 成功回應 (200 OK) + +```json +{ + "success": true, + "message": "CMAC verification successful", + "timestamp": "2025-07-04T15:30:14Z", + "details": { + "uid": "0456735AD51F90", + "counter": "000028", + "cmac": "222ED1BA962F7F5C", + "key_index": 1 + } +} +``` + +#### 驗證失敗回應 (200 OK) + +```json +{ + "success": false, + "message": "CMAC verification failed (status: 0x000000CA)", + "timestamp": "2025-07-04T15:30:14Z" +} +``` + +#### 錯誤回應 (400 Bad Request) + +```json +{ + "success": false, + "message": "Invalid UID format - must be 14 hex characters", + "timestamp": "2025-07-04T15:30:14Z" +} +``` + +### 2. `/health` - 健康檢查 + +**方法**: `GET` +**用途**: 檢查 API 服務狀態 + +#### 回應 (200 OK) + +```json +{ + "success": true, + "message": "CMAC Verification API is running", + "timestamp": "2025-07-04T15:30:14Z", + "version": "1.0", + "endpoints": ["/verify", "/health"] +} +``` + +### 3. `/` - 首頁 + +**方法**: `GET` +**用途**: 顯示 API 說明頁面 + +回應 HTML 格式的說明頁面,包含可用端點和使用範例。 + +## 錯誤碼 + +| HTTP 狀態碼 | 說明 | +|-------------|---------------------| +| 200 | 請求成功(包含驗證失敗) | +| 400 | 請求參數錯誤 | +| 405 | 不允許的 HTTP 方法 | +| 500 | 內部服務器錯誤 | + +## 使用範例 + +### cURL 範例 + +```bash +# 基本驗證 +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" + +# 使用不同金鑰 +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=2" + +# 健康檢查 +curl "http://localhost:8888/health" +``` + +### JavaScript 範例 + +```javascript +// 驗證 CMAC +async function verifyCMAC(uid, ctr, cmac, key) { + const url = `http://localhost:8888/verify?uid=${uid}&ctr=${ctr}&cmac=${cmac}&key=${key}`; + + try { + const response = await fetch(url); + const result = await response.json(); + + if (result.success) { + console.log('✅ CMAC 驗證成功'); + return true; + } else { + console.log('❌ CMAC 驗證失敗:', result.message); + return false; + } + } catch (error) { + console.error('請求失敗:', error); + return false; + } +} + +// 使用範例 +verifyCMAC('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1); +``` + +### Python 範例 + +```python +import requests +import json + +def verify_cmac(uid, ctr, cmac, key, host='localhost', port=8888): + """驗證 NTAG424 CMAC""" + url = f"http://{host}:{port}/verify" + params = { + 'uid': uid, + 'ctr': ctr, + 'cmac': cmac, + 'key': key + } + + try: + response = requests.get(url, params=params, timeout=5) + result = response.json() + + if result['success']: + print(f"✅ CMAC 驗證成功: {result['message']}") + return True + else: + print(f"❌ CMAC 驗證失敗: {result['message']}") + return False + + except requests.RequestException as e: + print(f"請求錯誤: {e}") + return False + +# 使用範例 +verify_cmac('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1) +``` + +## 部署說明 + +### 本地部署 + +1. **編譯 API 服務器**: + ```bash + make api-server + ``` + +2. **準備配置檔案**: + - 確保 `keys.txt` 檔案包含正確的 AES 金鑰 + - 每行一個金鑰,32 位十六進位字元 + +3. **啟動服務器**: + ```bash + cd linux64_release + ./cmac_api_server 8888 + ``` + +### ARM 部署 + +```bash +# 編譯 ARM64 版本 +make api-server-arm64 + +# 編譯 ARM32 版本 +make api-server-arm32 + +# 複製到 ARM 設備並啟動 +./cmac_api_server 8888 +``` + +### 服務化部署 + +創建 systemd 服務檔案 `/etc/systemd/system/cmac-api.service`: + +```ini +[Unit] +Description=NTAG424 CMAC Verification API +After=network.target + +[Service] +Type=simple +User=your-user +WorkingDirectory=/path/to/linux64_release +ExecStart=/path/to/linux64_release/cmac_api_server 8888 +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +``` + +啟動服務: +```bash +sudo systemctl enable cmac-api +sudo systemctl start cmac-api +``` + +## 安全考量 + +1. **金鑰保護**: + - `keys.txt` 檔案包含敏感的 AES 金鑰 + - 設定適當的檔案權限(例如 600) + - 避免在日誌中輸出完整金鑰 + +2. **網路安全**: + - 在生產環境中使用 HTTPS + - 考慮使用反向代理(如 nginx) + - 實施速率限制和 IP 白名單 + +3. **輸入驗證**: + - API 已實施基本的輸入格式驗證 + - 建議在客戶端也進行額外驗證 + +## 效能資訊 + +- **記憶體使用**:約 ~500KB +- **CPU 使用**:每次驗證 ~1ms +- **並發支援**:最多 10 個同時連接 +- **吞吐量**:約 1000+ 驗證/秒(取決於硬體) + +## 故障排除 + +### 常見問題 + +1. **端口已被使用**: + ``` + bind failed: Address already in use + ``` + 解決:使用不同端口或停止占用程序 + +2. **找不到金鑰檔案**: + ``` + 無法開啟 keys.txt 檔案 + ``` + 解決:確保 `keys.txt` 在執行目錄中 + +3. **連接被拒絕**: + - 檢查服務器是否正在運行 + - 檢查防火牆設定 + - 驗證端口號 + +### 除錯模式 + +啟動時可以看到詳細的啟動訊息和請求日誌。 + +## 技術規格 + +- **語言**:C +- **HTTP 服務器**:自定義輕量級實作 +- **JSON 處理**:手動序列化 +- **執行緒模型**:每請求一執行緒 +- **依賴**:uFCoder 函式庫、pthread + +## 版本歷史 + +- **v1.0** (2025-07-04):初始版本 + - 基本 CMAC 驗證功能 + - HTTP API 介面 + - 多金鑰支援 + - 錯誤處理 + +## 授權 + +本軟體遵循與主專案相同的授權條款。 + +--- + +**製作**: 基於 NTAG424 管理工具開發 +**更新**: 2025-07-04 \ No newline at end of file diff --git a/linux64_release/API_USAGE_GUIDE.md b/linux64_release/API_USAGE_GUIDE.md new file mode 100644 index 0000000..37a9411 --- /dev/null +++ b/linux64_release/API_USAGE_GUIDE.md @@ -0,0 +1,246 @@ +# NTAG424 CMAC 驗證 API 使用說明 + +## 🚀 1. 啟動 API 服務器 + +```bash +# 啟動服務器(預設端口 8080) +./cmac_api_server + +# 或指定自訂端口 +./cmac_api_server 8888 +``` + +啟動成功會看到: +``` +🚀 CMAC Verification API Server started on port 8888 +📍 Available endpoints: + GET /verify?uid=...&ctr=...&cmac=...&key=... + GET /health + GET / +🌐 Open http://localhost:8888 in your browser +``` + +## 🔍 2. 基本 API 呼叫 + +### 健康檢查 +```bash +curl "http://localhost:8888/health" +``` + +回應: +```json +{ + "success": true, + "message": "CMAC Verification API is running", + "timestamp": "2025-07-04T15:30:14Z" +} +``` + +### CMAC 驗證 +```bash +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" +``` + +## 📝 3. 參數說明 + +| 參數 | 說明 | 格式 | 範例 | +|--------|----------------------------|----------------|--------------------| +| `uid` | 卡片 UID | 14位十六進位 | `0456735AD51F90` | +| `ctr` | SDM 讀取計數器 | 6位十六進位 | `000028` | +| `cmac` | CMAC 值 | 16位十六進位 | `222ED1BA962F7F5C` | +| `key` | 金鑰索引(keys.txt中的行號)| 數字 1-10 | `1` | + +## ✅ 4. 成功回應 + +```json +{ + "success": true, + "message": "CMAC verification successful", + "timestamp": "2025-07-04T15:30:14Z", + "details": { + "uid": "0456735AD51F90", + "counter": "000028", + "cmac": "222ED1BA962F7F5C", + "key_index": 1 + } +} +``` + +## ❌ 5. 失敗回應 + +### 驗證失敗 +```json +{ + "success": false, + "message": "CMAC verification failed (status: 0x000000CA)", + "timestamp": "2025-07-04T15:30:14Z" +} +``` + +### 參數錯誤 +```json +{ + "success": false, + "message": "Invalid UID format - must be 14 hex characters", + "timestamp": "2025-07-04T15:30:14Z" +} +``` + +### 缺少參數 +```json +{ + "success": false, + "message": "Missing required parameters", + "timestamp": "2025-07-04T15:30:14Z", + "required": ["uid", "ctr", "cmac", "key"] +} +``` + +## 🌐 6. 完整 URL 範例 + +```bash +# 基本驗證 +http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1 + +# 使用不同金鑰 +http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=2 + +# 健康檢查 +http://localhost:8888/health + +# 首頁說明 +http://localhost:8888/ +``` + +## 💻 7. 程式化呼叫範例 + +### JavaScript (網頁/Node.js) +```javascript +async function verifyCMAC(uid, ctr, cmac, keyIndex) { + const url = `http://localhost:8888/verify?uid=${uid}&ctr=${ctr}&cmac=${cmac}&key=${keyIndex}`; + + try { + const response = await fetch(url); + const result = await response.json(); + + if (result.success) { + console.log('✅ 驗證成功'); + return true; + } else { + console.log('❌ 驗證失敗:', result.message); + return false; + } + } catch (error) { + console.error('API 呼叫失敗:', error); + return false; + } +} + +// 使用範例 +verifyCMAC('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1); +``` + +### Python +```python +import requests + +def verify_cmac(uid, ctr, cmac, key_index): + url = "http://localhost:8888/verify" + params = { + 'uid': uid, + 'ctr': ctr, + 'cmac': cmac, + 'key': key_index + } + + try: + response = requests.get(url, params=params, timeout=5) + result = response.json() + + if result['success']: + print(f"✅ 驗證成功: {result['message']}") + return True + else: + print(f"❌ 驗證失敗: {result['message']}") + return False + except Exception as e: + print(f"API 呼叫失敗: {e}") + return False + +# 使用範例 +verify_cmac('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1) +``` + +### PHP +```php + $uid, + 'ctr' => $ctr, + 'cmac' => $cmac, + 'key' => $keyIndex + ]); + + $response = file_get_contents($url); + $result = json_decode($response, true); + + if ($result['success']) { + echo "✅ 驗證成功\n"; + return true; + } else { + echo "❌ 驗證失敗: " . $result['message'] . "\n"; + return false; + } +} + +// 使用範例 +verifyCMAC('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1); +?> +``` + +## 🔧 8. 常見問題 + +### Q: 如何獲取 UID、計數器、CMAC? +**A**: 這些資料通常來自 NTAG424 卡片的 NDEF URL,格式如: +``` +https://example.com/nfc?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C +``` + +### Q: 金鑰索引是什麼? +**A**: 指向 `keys.txt` 檔案中的第幾行金鑰(從 1 開始計算) + +### Q: 為什麼驗證失敗? +**A**: 常見原因: +- UID、計數器、CMAC 格式不正確 +- 使用了錯誤的金鑰索引 +- 資料已過期或被篡改 + +### Q: 支援 HTTPS 嗎? +**A**: 目前僅支援 HTTP,生產環境建議使用 nginx 等反向代理提供 HTTPS + +## 🧪 9. 快速測試 + +執行自動化測試: +```bash +./test_api.sh +``` + +或手動測試: +```bash +# 1. 啟動服務器 +./cmac_api_server 8888 & + +# 2. 測試健康檢查 +curl "http://localhost:8888/health" + +# 3. 測試 CMAC 驗證 +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" + +# 4. 停止服務器 +pkill -f cmac_api_server +``` + +--- + +**需要更多資訊?** 查看 `API_DOCUMENTATION.md` 獲取完整技術文檔。 \ No newline at end of file diff --git a/linux64_release/DEVELOPER_MANUAL.md b/linux64_release/DEVELOPER_MANUAL.md new file mode 100644 index 0000000..4b4ef45 --- /dev/null +++ b/linux64_release/DEVELOPER_MANUAL.md @@ -0,0 +1,663 @@ +# NTAG424 Linux64 Release 開發者操作手冊 + +## 📋 目錄 +1. [概述](#概述) +2. [檔案結構](#檔案結構) +3. [快速開始](#快速開始) +4. [核心程式](#核心程式) +5. [API 服務](#api-服務) +6. [測試腳本](#測試腳本) +7. [配置檔案](#配置檔案) +8. [整合範例](#整合範例) +9. [故障排除](#故障排除) +10. [進階功能](#進階功能) + +--- + +## 概述 + +`linux64_release` 資料夾包含完整的 NTAG424 卡片管理解決方案,提供: +- **硬體操作**:直接與 NTAG424 卡片互動 +- **HTTP API**:遠端 CMAC 驗證服務 +- **測試套件**:完整的自動化測試 +- **生產工具**:批量處理和品質檢測 + +### 系統需求 +- Linux 64-bit 系統 +- uFR 讀卡機硬體 +- NTAG424 DNA 卡片 +- bash 4.0+ + +--- + +## 檔案結構 + +``` +linux64_release/ +├── 核心程式 +│ ├── nt4h_c_example # 主要 CLI 工具 +│ ├── cmac_api_server # HTTP API 服務器 +│ └── libnt4h_c.so # 動態函式庫 +│ +├── 配置檔案 +│ ├── keys.txt # AES 金鑰配置 +│ └── urls.txt # URL 模板配置 +│ +├── 測試腳本 +│ ├── test_ntag424.sh # 完整功能測試 +│ ├── simple_test.sh # 簡化測試 +│ ├── test_api.sh # API 功能測試 +│ ├── test_manual_verify.sh # 手動驗證測試 +│ └── test_new_card.sh # 新卡片處理測試 +│ +├── 生產工具 +│ └── ntag424_tool.sh # 綜合管理工具 +│ +├── 文檔 +│ ├── README_API.md # API 快速指南 +│ ├── API_DOCUMENTATION.md # 完整 API 文檔 +│ ├── API_USAGE_GUIDE.md # API 使用說明 +│ └── README_PRODUCTION.md # 生產環境指南 +│ +└── 日誌檔案 + └── ntag424_operations.log # 操作日誌 +``` + +--- + +## 快速開始 + +### 1. 基本環境檢查 +```bash +cd linux64_release + +# 檢查必要檔案 +ls -la nt4h_c_example keys.txt urls.txt + +# 檢查讀卡機連接 +lsusb | grep uFR +``` + +### 2. 基本操作 +```bash +# 讀取卡片 UID +./nt4h_c_example getuid --key 1 + +# 設定 SDM 功能 +./nt4h_c_example setsdm --url 1 --key 1 + +# 驗證 CMAC +./nt4h_c_example verify --key 1 +``` + +### 3. 啟動 API 服務 +```bash +# 啟動 API 服務器 +./cmac_api_server 8888 + +# 測試 API +curl "http://localhost:8888/health" +``` + +--- + +## 核心程式 + +### nt4h_c_example - 主要 CLI 工具 + +#### 基本語法 +```bash +./nt4h_c_example [options] +``` + +#### 主要命令 + +##### 1. 讀取 UID +```bash +# 詳細模式 +./nt4h_c_example getuid --key 1 + +# 安靜模式(僅輸出 UID) +./nt4h_c_example getuid --quiet --key 1 +``` + +##### 2. 設定 SDM +```bash +# 使用 URL 索引 1 和金鑰 1 +./nt4h_c_example setsdm --url 1 --key 1 + +# 安靜模式 +./nt4h_c_example setsdm --quiet --url 1 --key 1 +``` + +##### 3. CMAC 驗證 +```bash +# 標準驗證(需要讀卡機) +./nt4h_c_example verify --key 1 + +# 手動驗證(無需讀卡機) +./nt4h_c_example verify --manual --uid 0456735AD51F90 --ctr 000028 --cmac 222ED1BA962F7F5C --key 1 + +# URL 方式手動驗證 +./nt4h_c_example verify --manual --url "https://example.com/nfc?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C" --key 1 +``` + +##### 4. NDEF 操作 +```bash +# 寫入 NDEF +./nt4h_c_example writendef --url "https://example.com" + +# 從檔案寫入 +./nt4h_c_example writendef --url-index 1 + +# 讀取 NDEF +./nt4h_c_example readndef + +# 安靜模式讀取 +./nt4h_c_example readndef --quiet +``` + +##### 5. 金鑰管理 +```bash +# 變更金鑰 +./nt4h_c_example changekey --auth-key 1 --new-key 2 --old-key 1 --key-no 0 +``` + +#### 參數說明 +- `--key `: 指定金鑰索引 (1-10) +- `--url `: 指定 URL 索引 (1-4) +- `--quiet`: 安靜模式,僅輸出結果 +- `--manual`: 手動驗證模式 +- `--uid `: 手動指定 UID +- `--ctr `: 手動指定計數器 +- `--cmac `: 手動指定 CMAC + +--- + +## API 服務 + +### cmac_api_server - HTTP API 服務器 + +#### 啟動服務 +```bash +# 預設端口 8080 +./cmac_api_server + +# 指定端口 +./cmac_api_server 8888 +``` + +#### API 端點 + +##### 1. 健康檢查 +```bash +curl "http://localhost:8888/health" +``` + +回應: +```json +{ + "success": true, + "message": "CMAC Verification API is running", + "timestamp": "2025-01-XX T15:30:14Z", + "version": "1.0" +} +``` + +##### 2. CMAC 驗證 +```bash +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" +``` + +成功回應: +```json +{ + "success": true, + "message": "CMAC verification successful", + "timestamp": "2025-01-XX T15:30:14Z", + "details": { + "uid": "0456735AD51F90", + "counter": "000028", + "cmac": "222ED1BA962F7F5C", + "key_index": 1 + } +} +``` + +失敗回應: +```json +{ + "success": false, + "message": "CMAC verification failed (status: 0x000000CA)", + "timestamp": "2025-01-XX T15:30:14Z" +} +``` + +##### 3. API 說明頁面 +```bash +curl "http://localhost:8888/" +``` + +--- + +## 測試腳本 + +### 1. test_ntag424.sh - 完整功能測試 +```bash +# 執行完整測試套件(32項測試) +./test_ntag424.sh +``` + +**測試內容:** +- NDEF 功能測試 +- SDM 相關測試 +- 手動驗證測試 +- 錯誤處理測試 +- 金鑰管理測試 + +### 2. simple_test.sh - 簡化測試 +```bash +# 執行基本功能測試(9項測試) +./simple_test.sh +``` + +**適用場景:** +- 快速功能驗證 +- 開發過程中的基本測試 +- 新環境部署驗證 + +### 3. test_api.sh - API 功能測試 +```bash +# 測試 API 服務功能 +./test_api.sh +``` + +**測試內容:** +- 健康檢查 +- CMAC 驗證 +- 錯誤處理 +- 參數驗證 + +### 4. test_manual_verify.sh - 手動驗證測試 +```bash +# 測試手動驗證功能 +./test_manual_verify.sh +``` + +**測試內容:** +- 參數方式手動驗證 +- URL 方式手動驗證 +- 格式驗證 +- 錯誤處理 + +### 5. test_new_card.sh - 新卡片處理測試 +```bash +# 測試新卡片處理流程 +./test_new_card.sh +``` + +**測試內容:** +- 空白卡片檢測 +- 設定流程指導 +- 錯誤訊息驗證 + +--- + +## 配置檔案 + +### keys.txt - AES 金鑰配置 +``` +# 每行一個 32 位十六進位金鑰 +00000000000000000000000000000000 +00112233445566778899AABBCCDDEEFF +AABBCCDDEEFF00112233445566778899 +12345678901234567890123456789012 +``` + +**說明:** +- 第 1 行對應金鑰索引 1 +- 第 2 行對應金鑰索引 2 +- 最多支援 10 個金鑰 +- 每個金鑰必須是 32 位十六進位字元 + +### urls.txt - URL 模板配置 +``` +https://nodered.contree.app/nfc +https://nodered.contree.app/test +https://www.google.com/ +https://tatalotest1.gsct.tw/nfcWeb +``` + +**說明:** +- 每行一個 URL 模板 +- 用於 SDM 設定時的 URL 選擇 +- 支援動態參數(UID、計數器、CMAC) + +--- + +## 整合範例 + +### JavaScript 整合 +```javascript +// 驗證 CMAC +async function verifyCMAC(uid, ctr, cmac, keyIndex) { + const url = `http://localhost:8888/verify?uid=${uid}&ctr=${ctr}&cmac=${cmac}&key=${keyIndex}`; + + try { + const response = await fetch(url); + const result = await response.json(); + + if (result.success) { + console.log('✅ CMAC 驗證成功'); + return true; + } else { + console.log('❌ CMAC 驗證失敗:', result.message); + return false; + } + } catch (error) { + console.error('API 呼叫失敗:', error); + return false; + } +} + +// 使用範例 +verifyCMAC('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1); +``` + +### Python 整合 +```python +import requests +import json + +def verify_cmac(uid, ctr, cmac, key_index, host='localhost', port=8888): + """驗證 NTAG424 CMAC""" + url = f"http://{host}:{port}/verify" + params = { + 'uid': uid, + 'ctr': ctr, + 'cmac': cmac, + 'key': key_index + } + + try: + response = requests.get(url, params=params, timeout=5) + result = response.json() + + if result['success']: + print(f"✅ CMAC 驗證成功: {result['message']}") + return True + else: + print(f"❌ CMAC 驗證失敗: {result['message']}") + return False + + except requests.RequestException as e: + print(f"請求錯誤: {e}") + return False + +# 使用範例 +verify_cmac('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1) +``` + +### PHP 整合 +```php + $uid, + 'ctr' => $ctr, + 'cmac' => $cmac, + 'key' => $keyIndex + ]); + + $response = file_get_contents($url); + $result = json_decode($response, true); + + if ($result['success']) { + echo "✅ 驗證成功\n"; + return true; + } else { + echo "❌ 驗證失敗: " . $result['message'] . "\n"; + return false; + } +} + +// 使用範例 +verifyCMAC('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1); +?> +``` + +### Node.js 整合 +```javascript +const http = require('http'); + +function verifyCMAC(uid, ctr, cmac, keyIndex) { + return new Promise((resolve, reject) => { + const url = `http://localhost:8888/verify?uid=${uid}&ctr=${ctr}&cmac=${cmac}&key=${keyIndex}`; + + http.get(url, (res) => { + let data = ''; + + res.on('data', (chunk) => { + data += chunk; + }); + + res.on('end', () => { + try { + const result = JSON.parse(data); + if (result.success) { + console.log('✅ CMAC 驗證成功'); + resolve(true); + } else { + console.log('❌ CMAC 驗證失敗:', result.message); + resolve(false); + } + } catch (error) { + reject(error); + } + }); + }).on('error', (error) => { + reject(error); + }); + }); +} + +// 使用範例 +verifyCMAC('0456735AD51F90', '000028', '222ED1BA962F7F5C', 1) + .then(result => console.log('驗證結果:', result)) + .catch(error => console.error('錯誤:', error)); +``` + +--- + +## 故障排除 + +### 常見問題 + +#### 1. 讀卡機未檢測到 +**症狀:** 程式無法找到讀卡機 +**解決方案:** +```bash +# 檢查 USB 連接 +lsusb | grep uFR + +# 檢查驅動 +lsmod | grep ftdi + +# 重新插拔讀卡機 +``` + +#### 2. NDEF 格式驗證失敗 +**症狀:** 驗證時出現 NDEF 格式錯誤 +**解決方案:** +```bash +# 檢查卡片是否為新卡片 +./nt4h_c_example readndef + +# 如果是新卡片,先設定 SDM +./nt4h_c_example setsdm --url 1 --key 1 + +# 然後再驗證 +./nt4h_c_example verify --key 1 +``` + +#### 3. MAC 驗證失敗 +**症狀:** CMAC 驗證失敗 +**解決方案:** +```bash +# 檢查金鑰是否正確 +cat keys.txt + +# 確認使用正確的金鑰索引 +./nt4h_c_example verify --key 1 + +# 檢查 SDM 是否正確設定 +./nt4h_c_example setsdm --url 1 --key 1 +``` + +#### 4. API 服務無法啟動 +**症狀:** API 服務器啟動失敗 +**解決方案:** +```bash +# 檢查端口是否被占用 +netstat -tlnp | grep 8888 + +# 使用不同端口 +./cmac_api_server 9999 + +# 檢查檔案權限 +chmod +x cmac_api_server +``` + +#### 5. 手動驗證模式錯誤 +**症狀:** 手動驗證時出現格式錯誤 +**解決方案:** +```bash +# 檢查 UID 格式(14位十六進位) +echo "0456735AD51F90" | wc -c # 應該是 15(包含換行符) + +# 檢查計數器格式(6位十六進位) +echo "000028" | wc -c # 應該是 7 + +# 檢查 CMAC 格式(16位十六進位) +echo "222ED1BA962F7F5C" | wc -c # 應該是 17 +``` + +### 除錯技巧 + +#### 1. 啟用詳細輸出 +```bash +# 移除 --quiet 參數查看詳細輸出 +./nt4h_c_example verify --key 1 +``` + +#### 2. 檢查日誌檔案 +```bash +# 查看操作日誌 +tail -f ntag424_operations.log + +# 查看最近的錯誤 +grep "FAILED" ntag424_operations.log | tail -10 +``` + +#### 3. 使用測試腳本診斷 +```bash +# 執行完整測試診斷問題 +./test_ntag424.sh + +# 執行簡化測試快速檢查 +./simple_test.sh +``` + +--- + +## 進階功能 + +### 1. 批量處理 +```bash +# 使用綜合管理工具進行批量操作 +./ntag424_tool.sh + +# 選擇 "2) 批量操作模式" +# 輸入卡片數量和操作類型 +``` + +### 2. 品質檢測 +```bash +# 執行完整的品質檢測 +./ntag424_tool.sh + +# 選擇 "3) 質量檢測模式" +# 自動執行 6 項品質檢測 +``` + +### 3. 生產報告 +```bash +# 生成操作報告 +./ntag424_tool.sh + +# 選擇 "8) 生成操作報告" +# 查看詳細的統計資訊 +``` + +### 4. 系統監控 +```bash +# 檢查系統狀態 +./ntag424_tool.sh + +# 選擇 "9) 系統狀態檢查" +# 查看環境和設備狀態 +``` + +### 5. 自定義配置 +```bash +# 修改金鑰配置 +vim keys.txt + +# 修改 URL 配置 +vim urls.txt + +# 重新啟動服務 +pkill cmac_api_server +./cmac_api_server 8888 +``` + +--- + +## 性能指標 + +### 基準測試結果 +- **單次讀取 UID**: ~200ms +- **單次 SDM 設定**: ~500ms +- **單次 CMAC 驗證**: ~300ms +- **API 回應時間**: ~50ms +- **批量處理速度**: ~1秒/卡 + +### 建議使用場景 +- **小批量 (<50張)**: 單卡操作模式 +- **中批量 (50-200張)**: 批量操作模式 +- **大批量 (>200張)**: CLI 自動化腳本 +- **品質控制**: 質量檢測模式 +- **遠端驗證**: HTTP API 服務 + +--- + +## 技術支援 + +### 獲取幫助 +1. **查看系統狀態**: `./ntag424_tool.sh` → 選項 9 +2. **檢查操作日誌**: `./ntag424_tool.sh` → 選項 7 +3. **生成操作報告**: `./ntag424_tool.sh` → 選項 8 +4. **執行診斷測試**: `./test_ntag424.sh` + +### 文檔資源 +- `README_API.md` - API 快速指南 +- `API_DOCUMENTATION.md` - 完整 API 文檔 +- `API_USAGE_GUIDE.md` - API 使用說明 +- `README_PRODUCTION.md` - 生產環境指南 + +--- + +**NTAG424 Linux64 Release v2.0** +*專業、可靠、高效的 NTAG424 解決方案* + +最後更新:2025-01-XX diff --git a/linux64_release/README_API.md b/linux64_release/README_API.md new file mode 100644 index 0000000..ff5d0e5 --- /dev/null +++ b/linux64_release/README_API.md @@ -0,0 +1,59 @@ +# NTAG424 CMAC 驗證 API + +🚀 **輕量級 HTTP API 服務,提供 NTAG424 卡片 CMAC 驗證功能** + +## 🎯 快速開始 + +### 1. 啟動 API 服務器 +```bash +./cmac_api_server 8888 +``` + +### 2. 測試 API +```bash +# 健康檢查 +curl "http://localhost:8888/health" + +# CMAC 驗證 +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" +``` + +### 3. 執行完整測試 +```bash +./test_api.sh +``` + +## 📁 相關檔案 + +- `cmac_api_server` - API 服務器執行檔 +- `test_api.sh` - API 功能測試腳本 +- `API_DOCUMENTATION.md` - 完整 API 文檔 +- `keys.txt` - AES 金鑰配置檔案 + +## 🌐 API 端點 + +- `GET /verify` - CMAC 驗證(需要 uid, ctr, cmac, key 參數) +- `GET /health` - 健康檢查 +- `GET /` - API 說明頁面 + +## ✨ 特點 + +- ✅ 純軟體驗證,無需讀卡機 +- ✅ HTTP RESTful API +- ✅ JSON 回應格式 +- ✅ 多金鑰支援 (1-10) +- ✅ 多執行緒處理 +- ✅ CORS 支援 + +## 📖 詳細文檔 + +查看 [API_DOCUMENTATION.md](./API_DOCUMENTATION.md) 獲取: +- 完整 API 規格 +- 使用範例(cURL, JavaScript, Python) +- 部署指南 +- 安全建議 +- 故障排除 + +--- + +**製作**: 基於 NTAG424 管理工具開發 \ No newline at end of file diff --git a/linux64_release/README_PRODUCTION.md b/linux64_release/README_PRODUCTION.md new file mode 100644 index 0000000..397f998 --- /dev/null +++ b/linux64_release/README_PRODUCTION.md @@ -0,0 +1,251 @@ +# NTAG424 綜合管理工具 v2.0 + +專業級 NTAG424 卡片管理解決方案,整合生產操作與品質測試功能。 + +## 🔧 重要修正記錄 + +### v2.2 - 新增 HTTP API 服務 (2024-01-XX) +- **新增功能**: CMAC 驗證 HTTP API 服務 +- 提供 RESTful API 介面,支援遠端 CMAC 驗證 +- 無需讀卡機硬體,純軟體驗證 +- 支援多金鑰、多執行緒、CORS +- 適用場景:Web 應用、微服務、雲端部署 +- 新增 API 文檔:`API_DOCUMENTATION.md`、`API_USAGE_GUIDE.md` + +### v2.1 - 修正手動驗證模式 (2024-01-XX) +- **重要修正**: 手動驗證模式不再需要讀卡機 +- 修正了手動驗證模式錯誤嘗試開啟讀卡機的問題 +- 現在手動驗證完全基於軟體計算,支援離線驗證 +- 適用場景:遠端驗證、批量驗證、測試環境、無硬體環境 +- 新增專用測試腳本:`test_manual_verify.sh` + +## 🚀 快速開始 + +```bash +# 啟動綜合管理工具 +./ntag424_tool.sh + +# 或直接使用 CLI 模式 +./nt4h_c_example verify --key 1 +./nt4h_c_example setsdm --url 1 --key 1 +./nt4h_c_example getuid --key 1 +``` + +## 📋 功能特色 + +### 🏭 **生產功能** +- **單卡操作模式**: 互動式單張卡片處理 +- **批量操作模式**: 大量卡片自動化處理 +- **質量檢測模式**: 完整的 6 項品質檢測 + +### 🌐 **API 服務** +- **HTTP API 服務**: RESTful CMAC 驗證 API +- **多平台支援**: Linux64、ARM64、ARM32 +- **遠端驗證**: 無需讀卡機硬體的純軟體驗證 +- **高併發支援**: 多執行緒處理,支援同時多個請求 + +### 🧪 **測試功能** +- **完整功能測試**: 21 項全面測試 +- **新卡片處理測試**: 空白卡片處理流程 +- **壓力測試**: 高頻操作穩定性測試 +- **API 測試**: 自動化 API 功能測試 + +### 🔧 **工具功能** +- **操作日誌**: 自動記錄所有操作 +- **操作報告**: 生成詳細的執行報告 +- **系統狀態檢查**: 環境與設備狀態監控 + +## 💼 生產環境使用 + +### 批量卡片處理 +```bash +# 啟動工具選擇 "2) 批量操作模式" +./ntag424_tool.sh + +# 輸入參數: +# - 卡片數量: 100 +# - 操作類型: setup (設定 SDM) +# - 靜默模式: y +``` + +### 質量檢測流程 +```bash +# 啟動工具選擇 "3) 質量檢測模式" +./ntag424_tool.sh + +# 自動執行 6 項檢測: +# 1. 讀卡機連接檢測 +# 2. 卡片識別檢測 +# 3. SDM 功能檢測 +# 4. NDEF 格式檢測 +# 5. MAC 驗證檢測 +# 6. 手動驗證檢測 + +# 品質得分: +# 95%+ : 🏆 優秀品質 +# 80%+ : ⚠️ 良好品質 +# <80% : ❌ 品質不合格 +``` + +## 🔄 CLI 自動化模式 + +### 基本操作 +```bash +# 讀取 UID (安靜模式) +./nt4h_c_example getuid --quiet --key 1 + +# 設定 SDM (使用第1個URL和金鑰) +./nt4h_c_example setsdm --quiet --url 1 --key 1 + +# 驗證 CMAC (安靜模式) +./nt4h_c_example verify --quiet --key 1 + +# 手動驗證 (URL 模式) +./nt4h_c_example verify --manual --quiet --url "https://example.com/test?uid=...&ctr=...&cmac=..." --key 1 + +# 啟動 API 服務器 +./cmac_api_server 8888 + +# API 驗證 (HTTP 請求) +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" +``` + +### 高級操作 +```bash +# 變更金鑰 +./nt4h_c_example changekey --quiet --auth-key 1 --new-key 2 --old-key 1 --key-no 0 + +# 手動驗證 (參數模式) +./nt4h_c_example verify --manual --quiet --uid 0487715AD51F90 --ctr 000010 --cmac 8970E5C778F4234C --key 1 +``` + +## 🌐 HTTP API 服務 + +### 快速開始 +```bash +# 啟動 API 服務器 +./cmac_api_server 8888 + +# 健康檢查 +curl "http://localhost:8888/health" + +# CMAC 驗證 +curl "http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1" +``` + +### API 端點 +- `GET /verify` - CMAC 驗證 (需要 uid, ctr, cmac, key 參數) +- `GET /health` - 健康檢查 +- `GET /` - API 說明頁面 + +### 程式化呼叫範例 +```javascript +// JavaScript 範例 +const response = await fetch('http://localhost:8888/verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1'); +const result = await response.json(); +console.log(result.success ? '✅ 驗證成功' : '❌ 驗證失敗'); +``` + +### 詳細文檔 +- `API_USAGE_GUIDE.md` - 簡潔使用說明 +- `API_DOCUMENTATION.md` - 完整技術文檔 +- `test_api.sh` - API 功能測試腳本 +``` + +## 📁 配置檔案 + +### keys.txt +``` +# AES 金鑰配置 (每行一個16進位金鑰) +00000000000000000000000000000000 +11111111111111111111111111111111 +22222222222222222222222222222222 +... +``` + +### urls.txt +``` +# URL 模板配置 (每行一個URL) +https://nodered.contree.app/test +https://example.com/nfc +https://myserver.com/verify +... +``` + +## 📊 監控與報告 + +### 即時監控 +- 操作成功率統計 +- 執行時間追蹤 +- 錯誤詳細記錄 +- 系統資源監控 + +### 自動報告 +- 每次退出自動生成報告 +- 包含操作統計與系統資訊 +- 檔名格式: `ntag424_report_YYYYMMDD_HHMMSS.txt` + +### 日誌系統 +- 所有操作自動記錄到 `ntag424_operations.log` +- 時間戳記 + 操作類型 + 結果 + 詳細資訊 +- 支援日誌查看與分析 + +## 🛠️ 新卡片處理 + +### 自動檢測 +- 空白 NDEF 檔案自動識別 +- 友善錯誤提示訊息 +- 操作指引建議 + +### 處理流程 +```bash +# 檢測新卡片時的建議流程: +1. ./nt4h_c_example setsdm --url 1 --key 1 # 先設定 SDM +2. ./nt4h_c_example verify --key 1 # 再進行驗證 +``` + +## 🔧 故障排除 + +### 常見問題 +1. **讀卡機未檢測到** + - 檢查 USB 連接 + - 執行 `lsusb | grep uFR` + +2. **NDEF 格式驗證失敗** + - 使用新卡片處理測試 + - 先執行 SDM 設定 + +3. **MAC 驗證失敗** + - 檢查金鑰是否正確 + - 確認 SDM 已正確設定 + +### 系統需求 +- Linux 64-bit +- uFR 讀卡機驅動 +- NTAG424 DNA 卡片 +- bash 4.0+ + +## 📈 性能指標 + +### 基準測試 +- 單次讀取 UID: ~200ms +- 單次 SDM 設定: ~500ms +- 單次 CMAC 驗證: ~300ms +- 批量處理: ~1秒/卡 + +### 建議使用場景 +- **小批量 (<50張)**: 單卡操作模式 +- **中批量 (50-200張)**: 批量操作模式 +- **大批量 (>200張)**: CLI 自動化腳本 +- **品質控制**: 質量檢測模式 + +## 📞 技術支援 + +如需技術支援或功能建議,請檢查: +1. 系統狀態 (工具選項 9) +2. 操作日誌 (工具選項 7) +3. 操作報告 (工具選項 8) + +--- + +**NTAG424 綜合管理工具 v2.0** - 專業、可靠、高效的 NTAG424 解決方案 \ No newline at end of file diff --git a/linux64_release/cmac_api_server b/linux64_release/cmac_api_server new file mode 100644 index 0000000..0b121b9 Binary files /dev/null and b/linux64_release/cmac_api_server differ diff --git a/linux64_release/keys.txt b/linux64_release/keys.txt new file mode 100644 index 0000000..0015de6 --- /dev/null +++ b/linux64_release/keys.txt @@ -0,0 +1,4 @@ +00000000000000000000000000000000 +00112233445566778899AABBCCDDEEFF +AABBCCDDEEFF00112233445566778899 +12345678901234567890123456789012 diff --git a/linux64_release/libnt4h_c.so b/linux64_release/libnt4h_c.so new file mode 100644 index 0000000..bddacbb Binary files /dev/null and b/linux64_release/libnt4h_c.so differ diff --git a/linux64_release/nt4h_c_example b/linux64_release/nt4h_c_example new file mode 100644 index 0000000..da3f2d1 Binary files /dev/null and b/linux64_release/nt4h_c_example differ diff --git a/linux64_release/nt4h_c_example.org b/linux64_release/nt4h_c_example.org new file mode 100644 index 0000000..68df63a Binary files /dev/null and b/linux64_release/nt4h_c_example.org differ diff --git a/linux64_release/ntag424_operations.log b/linux64_release/ntag424_operations.log new file mode 100644 index 0000000..a68afdf --- /dev/null +++ b/linux64_release/ntag424_operations.log @@ -0,0 +1 @@ +2025-07-04 21:55:13 | 卡片識別 | FAILED | Command: ./nt4h_c_example getuid --quiet --key 1 | Error: FAILED diff --git a/linux64_release/ntag424_tool.sh b/linux64_release/ntag424_tool.sh new file mode 100644 index 0000000..a38d874 --- /dev/null +++ b/linux64_release/ntag424_tool.sh @@ -0,0 +1,457 @@ +#!/bin/bash + +# NTAG424 綜合管理工具 +# 版本: 2.0 +# 功能: 生產環境操作 + 完整測試套件 +# 支援: 批量操作、質量檢測、生產報告 + +set -e + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' + +# 工具配置 +EXECUTABLE="./nt4h_c_example" +LOG_FILE="ntag424_operations.log" +REPORT_FILE="ntag424_report_$(date +%Y%m%d_%H%M%S).txt" + +# 統計變量 +TOTAL_OPERATIONS=0 +SUCCESS_OPERATIONS=0 +FAILED_OPERATIONS=0 + +# 日誌函數 +log_operation() { + local operation="$1" + local result="$2" + local details="$3" + echo "$(date '+%Y-%m-%d %H:%M:%S') | $operation | $result | $details" >> "$LOG_FILE" +} + +# 執行操作函數 +execute_operation() { + local operation_name="$1" + local command="$2" + local expected_output="$3" + local quiet_mode="$4" + + TOTAL_OPERATIONS=$((TOTAL_OPERATIONS + 1)) + + if [[ "$quiet_mode" != "true" ]]; then + echo -e "${BLUE}[操作] ${operation_name}${NC}" + echo "執行: $command" + fi + + local output + local exit_code=0 + if output=$(eval "$command" 2>&1); then + exit_code=0 + else + exit_code=$? + fi + + if [[ $exit_code -eq 0 ]] && [[ -z "$expected_output" || "$output" == *"$expected_output"* ]]; then + if [[ "$quiet_mode" != "true" ]]; then + echo -e "${GREEN}✓ 成功${NC}" + fi + SUCCESS_OPERATIONS=$((SUCCESS_OPERATIONS + 1)) + log_operation "$operation_name" "SUCCESS" "Command: $command" + return 0 + else + if [[ "$quiet_mode" != "true" ]]; then + echo -e "${RED}✗ 失敗${NC}" + echo "錯誤: $output" + fi + FAILED_OPERATIONS=$((FAILED_OPERATIONS + 1)) + log_operation "$operation_name" "FAILED" "Command: $command | Error: $output" + return 1 + fi +} + +# 主選單 +show_main_menu() { + clear + echo -e "${CYAN}========================================${NC}" + echo -e "${CYAN} NTAG424 綜合管理工具 v2.0${NC}" + echo -e "${CYAN}========================================${NC}" + echo "" + echo -e "${YELLOW}生產功能:${NC}" + echo " 1) 單卡操作模式" + echo " 2) 批量操作模式" + echo " 3) 質量檢測模式" + echo "" + echo -e "${YELLOW}測試功能:${NC}" + echo " 4) 完整功能測試" + echo " 5) 新卡片處理測試" + echo " 6) 壓力測試" + echo "" + echo -e "${YELLOW}工具功能:${NC}" + echo " 7) 查看操作日誌" + echo " 8) 生成操作報告" + echo " 9) 系統狀態檢查" + echo "" + echo " 0) 退出" + echo "" +} + +# 單卡操作模式 +single_card_mode() { + echo -e "${PURPLE}=== 單卡操作模式 ===${NC}" + echo "" + echo "1) 讀取 UID" + echo "2) 設定 SDM" + echo "3) 驗證 CMAC" + echo "4) 變更金鑰" + echo "5) 返回主選單" + echo "" + read -p "請選擇操作 [1-5]: " choice + + case $choice in + 1) + echo -e "${BLUE}讀取卡片 UID...${NC}" + execute_operation "讀取UID" "$EXECUTABLE getuid --key 1" "UID:" + ;; + 2) + echo -e "${BLUE}設定 SDM 功能...${NC}" + read -p "URL 索引 [1]: " url_idx + url_idx=${url_idx:-1} + execute_operation "設定SDM" "$EXECUTABLE setsdm --url $url_idx --key 1" "SDM 設定" + ;; + 3) + echo -e "${BLUE}驗證 CMAC...${NC}" + execute_operation "驗證CMAC" "$EXECUTABLE verify --key 1" "MAC 驗證成功" + ;; + 4) + echo -e "${BLUE}變更金鑰...${NC}" + read -p "新金鑰索引 [2]: " new_key + new_key=${new_key:-2} + execute_operation "變更金鑰" "$EXECUTABLE changekey --auth-key 1 --new-key $new_key --old-key 1 --key-no 0" "變更 AES 金鑰" + ;; + 5) + return + ;; + *) + echo "無效選擇" + ;; + esac + + echo "" + read -p "按 Enter 繼續..." +} + +# 批量操作模式 +batch_mode() { + echo -e "${PURPLE}=== 批量操作模式 ===${NC}" + echo "" + read -p "要處理的卡片數量: " card_count + read -p "操作類型 [setup/verify/getuid]: " operation + read -p "是否靜默模式 [y/N]: " quiet + + local quiet_flag="" + if [[ "$quiet" == "y" || "$quiet" == "Y" ]]; then + quiet_flag="--quiet" + fi + + echo "" + echo -e "${BLUE}開始批量處理 $card_count 張卡片...${NC}" + + for ((i=1; i<=card_count; i++)); do + echo -e "${YELLOW}處理第 $i 張卡片...${NC}" + echo "請放置卡片,按 Enter 繼續..." + read -s + + case $operation in + "setup") + execute_operation "批量設定-$i" "$EXECUTABLE setsdm $quiet_flag --url 1 --key 1" "SUCCEED" "true" + ;; + "verify") + execute_operation "批量驗證-$i" "$EXECUTABLE verify $quiet_flag --key 1" "SUCCEED" "true" + ;; + "getuid") + execute_operation "批量讀UID-$i" "$EXECUTABLE getuid $quiet_flag --key 1" "SUCCEED" "true" + ;; + esac + + if [[ $? -eq 0 ]]; then + echo -e "${GREEN}✓ 第 $i 張卡片處理成功${NC}" + else + echo -e "${RED}✗ 第 $i 張卡片處理失敗${NC}" + fi + done + + echo "" + echo -e "${GREEN}批量處理完成!${NC}" + echo "成功: $SUCCESS_OPERATIONS 張" + echo "失敗: $FAILED_OPERATIONS 張" + echo "" + read -p "按 Enter 繼續..." +} + +# 質量檢測模式 +quality_check_mode() { + echo -e "${PURPLE}=== 質量檢測模式 ===${NC}" + echo "" + echo "執行完整的卡片質量檢測..." + + local start_time=$(date +%s) + + # 檢測項目 + echo -e "${BLUE}1. 讀卡機連接檢測${NC}" + if lsusb | grep -q "uFR"; then + echo -e "${GREEN}✓ 讀卡機連接正常${NC}" + SUCCESS_OPERATIONS=$((SUCCESS_OPERATIONS + 1)) + else + echo -e "${RED}✗ 讀卡機連接異常${NC}" + FAILED_OPERATIONS=$((FAILED_OPERATIONS + 1)) + fi + + echo -e "${BLUE}2. 卡片識別檢測${NC}" + execute_operation "卡片識別" "$EXECUTABLE getuid --quiet --key 1" "SUCCEED" "true" + + echo -e "${BLUE}3. SDM 功能檢測${NC}" + execute_operation "SDM設定" "$EXECUTABLE setsdm --quiet --url 1 --key 1" "SUCCEED" "true" + + echo -e "${BLUE}4. NDEF 格式檢測${NC}" + execute_operation "NDEF驗證" "$EXECUTABLE verify --key 1" "NDEF 格式驗證通過" + + echo -e "${BLUE}5. MAC 驗證檢測${NC}" + execute_operation "MAC驗證" "$EXECUTABLE verify --quiet --key 1" "SUCCEED" "true" + + echo -e "${BLUE}6. 手動驗證檢測${NC}" + local verify_output + if verify_output=$($EXECUTABLE verify --key 1 2>&1); then + local uid=$(echo "$verify_output" | grep "UID:" | awk '{print $2}') + local ctr=$(echo "$verify_output" | grep "SDM 讀取計數器:" | awk '{print $3}') + local mac=$(echo "$verify_output" | grep "ASCII MAC 資料:" | awk '{print $4}') + + if [[ -n "$uid" && -n "$ctr" && -n "$mac" ]]; then + execute_operation "手動驗證" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 1" "SUCCEED" "true" + fi + fi + + local end_time=$(date +%s) + local duration=$((end_time - start_time)) + + echo "" + echo -e "${GREEN}質量檢測完成!${NC}" + echo "檢測時間: ${duration} 秒" + echo "通過項目: $SUCCESS_OPERATIONS" + echo "失敗項目: $FAILED_OPERATIONS" + + local quality_score=$((SUCCESS_OPERATIONS * 100 / TOTAL_OPERATIONS)) + echo "質量得分: ${quality_score}%" + + if [[ $quality_score -ge 95 ]]; then + echo -e "${GREEN}🏆 優秀品質${NC}" + elif [[ $quality_score -ge 80 ]]; then + echo -e "${YELLOW}⚠️ 良好品質${NC}" + else + echo -e "${RED}❌ 品質不合格${NC}" + fi + + echo "" + read -p "按 Enter 繼續..." +} + +# 完整功能測試 +full_test_mode() { + echo -e "${PURPLE}=== 完整功能測試 ===${NC}" + echo "" + echo "執行所有功能的完整測試..." + + # 執行原有的測試腳本 + if [[ -f "test_ntag424.sh" ]]; then + chmod +x test_ntag424.sh + ./test_ntag424.sh + else + echo -e "${RED}找不到測試腳本 test_ntag424.sh${NC}" + fi + + echo "" + read -p "按 Enter 繼續..." +} + +# 新卡片處理測試 +new_card_test_mode() { + echo -e "${PURPLE}=== 新卡片處理測試 ===${NC}" + echo "" + + if [[ -f "test_new_card.sh" ]]; then + chmod +x test_new_card.sh + ./test_new_card.sh + else + echo -e "${RED}找不到新卡片測試腳本 test_new_card.sh${NC}" + fi + + echo "" + read -p "按 Enter 繼續..." +} + +# 壓力測試 +stress_test_mode() { + echo -e "${PURPLE}=== 壓力測試模式 ===${NC}" + echo "" + read -p "測試循環次數 [100]: " cycles + cycles=${cycles:-100} + + echo "開始壓力測試,執行 $cycles 次循環..." + + for ((i=1; i<=cycles; i++)); do + echo -ne "\r測試循環: $i/$cycles" + + # 隨機選擇操作 + case $((RANDOM % 3)) in + 0) + $EXECUTABLE getuid --quiet --key 1 >/dev/null 2>&1 && SUCCESS_OPERATIONS=$((SUCCESS_OPERATIONS + 1)) || FAILED_OPERATIONS=$((FAILED_OPERATIONS + 1)) + ;; + 1) + $EXECUTABLE verify --quiet --key 1 >/dev/null 2>&1 && SUCCESS_OPERATIONS=$((SUCCESS_OPERATIONS + 1)) || FAILED_OPERATIONS=$((FAILED_OPERATIONS + 1)) + ;; + 2) + $EXECUTABLE setsdm --quiet --url 1 --key 1 >/dev/null 2>&1 && SUCCESS_OPERATIONS=$((SUCCESS_OPERATIONS + 1)) || FAILED_OPERATIONS=$((FAILED_OPERATIONS + 1)) + ;; + esac + + TOTAL_OPERATIONS=$((TOTAL_OPERATIONS + 1)) + sleep 0.1 + done + + echo "" + echo -e "${GREEN}壓力測試完成!${NC}" + echo "總操作: $TOTAL_OPERATIONS" + echo "成功: $SUCCESS_OPERATIONS" + echo "失敗: $FAILED_OPERATIONS" + echo "成功率: $((SUCCESS_OPERATIONS * 100 / TOTAL_OPERATIONS))%" + + echo "" + read -p "按 Enter 繼續..." +} + +# 查看操作日誌 +view_logs() { + echo -e "${PURPLE}=== 操作日誌 ===${NC}" + echo "" + + if [[ -f "$LOG_FILE" ]]; then + echo "最近 20 條操作記錄:" + echo "----------------------------------------" + tail -n 20 "$LOG_FILE" + else + echo "目前沒有操作日誌" + fi + + echo "" + read -p "按 Enter 繼續..." +} + +# 生成操作報告 +generate_report() { + echo -e "${PURPLE}=== 生成操作報告 ===${NC}" + echo "" + + cat > "$REPORT_FILE" << EOF +NTAG424 綜合管理工具 - 操作報告 +===================================== + +報告生成時間: $(date) +工具版本: v2.0 + +操作統計: +- 總操作數: $TOTAL_OPERATIONS +- 成功操作: $SUCCESS_OPERATIONS +- 失敗操作: $FAILED_OPERATIONS +- 成功率: $((TOTAL_OPERATIONS > 0 ? SUCCESS_OPERATIONS * 100 / TOTAL_OPERATIONS : 0))% + +系統資訊: +- 作業系統: $(uname -a) +- 讀卡機狀態: $(lsusb | grep -q "uFR" && echo "已連接" || echo "未檢測到") +- 工具路徑: $(pwd) + +配置檔案檢查: +- keys.txt: $(test -f "keys.txt" && echo "存在" || echo "缺失") +- urls.txt: $(test -f "urls.txt" && echo "存在" || echo "缺失") +- 可執行檔: $(test -f "$EXECUTABLE" && echo "存在" || echo "缺失") + +最近操作記錄: +$(test -f "$LOG_FILE" && tail -n 10 "$LOG_FILE" || echo "無操作記錄") + +===================================== +報告結束 +EOF + + echo -e "${GREEN}報告已生成: $REPORT_FILE${NC}" + echo "" + read -p "按 Enter 繼續..." +} + +# 系統狀態檢查 +system_check() { + echo -e "${PURPLE}=== 系統狀態檢查 ===${NC}" + echo "" + + echo -e "${BLUE}檢查必要檔案...${NC}" + for file in "$EXECUTABLE" "keys.txt" "urls.txt"; do + if [[ -f "$file" ]]; then + echo -e "${GREEN}✓ $file${NC}" + else + echo -e "${RED}✗ $file (缺失)${NC}" + fi + done + + echo "" + echo -e "${BLUE}檢查讀卡機連接...${NC}" + if lsusb | grep -q "uFR"; then + echo -e "${GREEN}✓ uFR 讀卡機已連接${NC}" + else + echo -e "${YELLOW}⚠ 未檢測到 uFR 讀卡機${NC}" + fi + + echo "" + echo -e "${BLUE}檢查系統資源...${NC}" + echo "CPU 使用率: $(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d% -f1)%" + echo "記憶體使用: $(free | grep Mem | awk '{printf "%.1f%%", $3/$2 * 100.0}')" + echo "磁碟空間: $(df . | tail -1 | awk '{print $5}')" + + echo "" + read -p "按 Enter 繼續..." +} + +# 主程式循環 +main() { + while true; do + show_main_menu + read -p "請選擇功能 [0-9]: " choice + + case $choice in + 1) single_card_mode ;; + 2) batch_mode ;; + 3) quality_check_mode ;; + 4) full_test_mode ;; + 5) new_card_test_mode ;; + 6) stress_test_mode ;; + 7) view_logs ;; + 8) generate_report ;; + 9) system_check ;; + 0) + echo -e "${GREEN}感謝使用 NTAG424 綜合管理工具!${NC}" + generate_report + exit 0 + ;; + *) + echo -e "${RED}無效選擇,請重新輸入${NC}" + sleep 1 + ;; + esac + done +} + +# 啟動程式 +echo -e "${CYAN}正在啟動 NTAG424 綜合管理工具...${NC}" +sleep 1 +main \ No newline at end of file diff --git a/linux64_release/simple_test.sh b/linux64_release/simple_test.sh new file mode 100644 index 0000000..fce37be --- /dev/null +++ b/linux64_release/simple_test.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +# NTAG424 簡化測試腳本 +# 專為固定放置 NTAG424 卡片設計 + +set -e + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# 可執行檔案 +EXEC="./nt4h_c_example" + +echo -e "${YELLOW}========================================${NC}" +echo -e "${YELLOW} NTAG424 簡化測試腳本${NC}" +echo -e "${YELLOW}========================================${NC}" +echo "" + +# 檢查檔案 +if [[ ! -f "$EXEC" ]]; then + echo -e "${RED}錯誤: 找不到 $EXEC${NC}" + exit 1 +fi + +if [[ ! -f "keys.txt" ]]; then + echo -e "${RED}錯誤: 找不到 keys.txt${NC}" + exit 1 +fi + +if [[ ! -f "urls.txt" ]]; then + echo -e "${RED}錯誤: 找不到 urls.txt${NC}" + exit 1 +fi + +echo -e "${GREEN}✓ 所有必要檔案都存在${NC}" +echo "" + +# 測試函數 +run_test() { + local name="$1" + local cmd="$2" + local expected="$3" + + echo -e "${BLUE}[測試] $name${NC}" + echo "執行: $cmd" + + if output=$(eval "$cmd" 2>&1); then + if [[ -n "$expected" ]]; then + if echo "$output" | grep -q "$expected"; then + echo -e "${GREEN}✓ 通過${NC}" + return 0 + else + echo -e "${RED}✗ 失敗 - 未找到: $expected${NC}" + echo "輸出: $output" + return 1 + fi + else + echo -e "${GREEN}✓ 通過${NC}" + return 0 + fi + else + echo -e "${RED}✗ 失敗 - 命令錯誤${NC}" + echo "錯誤: $output" + return 1 + fi +} + +# 測試計數器 +passed=0 +failed=0 + +# 測試 1: 讀取 UID +if run_test "讀取 UID" "$EXEC getuid --quiet --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 2: CMAC 驗證 +if run_test "CMAC 驗證" "$EXEC verify --quiet --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 3: 快速 SDM 設定 +if run_test "快速 SDM 設定" "$EXEC setsdm --quiet --url 1 --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 4: 使用不同金鑰 +if run_test "使用金鑰 2" "$EXEC verify --quiet --key 2" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 5: 使用不同 URL +if run_test "使用 URL 2" "$EXEC setsdm --quiet --url 2 --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 6: 詳細模式讀取 UID +if run_test "詳細模式讀取 UID" "$EXEC getuid --key 1" "UID:"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 7: 詳細模式 CMAC 驗證 +if run_test "詳細模式 CMAC 驗證" "$EXEC verify --key 1" "MAC 驗證"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 8: 手動驗證模式 +echo -e "${BLUE}[測試] 手動驗證模式${NC}" +echo "正在讀取卡片資料..." + +# 讀取實際資料進行手動驗證 +if verify_output=$($EXEC verify --key 1 2>&1); then + uid=$(echo "$verify_output" | grep "UID:" | awk '{print $2}') + ctr=$(echo "$verify_output" | grep "計數器:" | awk '{print $2}') + mac=$(echo "$verify_output" | grep "MAC:" | awk '{print $2}') + + if [[ -n "$uid" && -n "$ctr" && -n "$mac" ]]; then + if run_test "手動驗證" "$EXEC verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 1" "SUCCEED"; then + ((passed++)) + else + ((failed++)) + fi + else + echo -e "${YELLOW}⚠ 跳過手動驗證 - 無法解析資料${NC}" + ((passed++)) + fi +else + echo -e "${YELLOW}⚠ 跳過手動驗證 - 無法讀取卡片${NC}" + ((passed++)) +fi + +# 測試 9: 錯誤處理 +if run_test "錯誤處理 - 無效命令" "$EXEC invalid_command" "未知命令"; then + ((passed++)) +else + ((failed++)) +fi + +# 顯示結果 +echo "" +echo -e "${YELLOW}========================================${NC}" +echo -e "${YELLOW} 測試結果${NC}" +echo -e "${YELLOW}========================================${NC}" +echo -e "通過: ${GREEN}$passed${NC}" +echo -e "失敗: ${RED}$failed${NC}" +echo -e "總計: $((passed + failed))" + +if [[ $failed -eq 0 ]]; then + echo -e "${GREEN}🎉 所有測試通過!${NC}" + exit 0 +else + echo -e "${RED}❌ 有 $failed 個測試失敗${NC}" + exit 1 +fi \ No newline at end of file diff --git a/linux64_release/test_api.sh b/linux64_release/test_api.sh new file mode 100644 index 0000000..3c7741d --- /dev/null +++ b/linux64_release/test_api.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# CMAC API 測試腳本 + +echo "🚀 啟動 CMAC 驗證 API 測試..." + +# 啟動 API 服務器 +echo "📡 啟動 API 服務器..." +./cmac_api_server 8888 & +API_PID=$! + +# 等待服務器啟動 +sleep 3 + +# 檢查服務器是否啟動 +if ! ps -p $API_PID > /dev/null 2>&1; then + echo "❌ API 服務器啟動失敗" + exit 1 +fi + +echo "✅ API 服務器已啟動 (PID: $API_PID)" + +# 測試健康檢查 +echo "" +echo "🏥 測試健康檢查..." +if HEALTH_RESPONSE=$(curl -s -m 5 "http://localhost:8888/health" 2>/dev/null); then + echo "✅ 健康檢查成功:" + echo "$HEALTH_RESPONSE" | head -5 +else + echo "❌ 健康檢查失敗" +fi + +# 測試首頁 +echo "" +echo "🏠 測試首頁..." +if HOME_RESPONSE=$(curl -s -m 5 "http://localhost:8888/" 2>/dev/null); then + echo "✅ 首頁測試成功:" + echo "$HOME_RESPONSE" | grep -o '.*' || echo "HTML 回應正常" +else + echo "❌ 首頁測試失敗" +fi + +# 測試 CMAC 驗證 (使用之前測試成功的資料) +echo "" +echo "🔐 測試 CMAC 驗證..." +TEST_UID="0456735AD51F90" +TEST_CTR="000028" +TEST_CMAC="222ED1BA962F7F5C" +TEST_KEY="1" + +VERIFY_URL="http://localhost:8888/verify?uid=${TEST_UID}&ctr=${TEST_CTR}&cmac=${TEST_CMAC}&key=${TEST_KEY}" + +if VERIFY_RESPONSE=$(curl -s -m 5 "$VERIFY_URL" 2>/dev/null); then + echo "✅ CMAC 驗證測試成功:" + echo "$VERIFY_RESPONSE" +else + echo "❌ CMAC 驗證測試失敗" +fi + +# 測試錯誤的 CMAC +echo "" +echo "🚫 測試錯誤 CMAC (預期失敗)..." +WRONG_CMAC="FFFFFFFFFFFFFFFF" +WRONG_URL="http://localhost:8888/verify?uid=${TEST_UID}&ctr=${TEST_CTR}&cmac=${WRONG_CMAC}&key=${TEST_KEY}" + +if WRONG_RESPONSE=$(curl -s -m 5 "$WRONG_URL" 2>/dev/null); then + echo "✅ 錯誤 CMAC 測試成功:" + echo "$WRONG_RESPONSE" +else + echo "❌ 錯誤 CMAC 測試失敗" +fi + +# 測試缺少參數 +echo "" +echo "📝 測試缺少參數 (預期失敗)..." +INCOMPLETE_URL="http://localhost:8888/verify?uid=${TEST_UID}&ctr=${TEST_CTR}" + +if INCOMPLETE_RESPONSE=$(curl -s -m 5 "$INCOMPLETE_URL" 2>/dev/null); then + echo "✅ 缺少參數測試成功:" + echo "$INCOMPLETE_RESPONSE" +else + echo "❌ 缺少參數測試失敗" +fi + +# 清理 +echo "" +echo "🧹 清理中..." +kill $API_PID 2>/dev/null +wait $API_PID 2>/dev/null + +echo "" +echo "✅ API 測試完成!" \ No newline at end of file diff --git a/linux64_release/test_manual_verify.sh b/linux64_release/test_manual_verify.sh new file mode 100644 index 0000000..2a822e2 --- /dev/null +++ b/linux64_release/test_manual_verify.sh @@ -0,0 +1,129 @@ +#!/bin/bash + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +EXEC="./nt4h_c_example" +PASSED=0 +FAILED=0 + +echo -e "${BLUE}=======================================${NC}" +echo -e "${BLUE} 手動驗證模式測試腳本${NC}" +echo -e "${BLUE}=======================================${NC}" +echo "" + +# 測試函數 +run_test() { + local test_name="$1" + local command="$2" + local expected="$3" + local allow_fail="$4" + + echo -e "${YELLOW}[測試] $test_name${NC}" + echo "執行: $command" + + if output=$(eval $command 2>&1); then + if [[ "$output" == *"$expected"* ]]; then + echo -e "${GREEN}✓ 通過${NC}" + ((PASSED++)) + else + if [[ "$allow_fail" == "true" ]]; then + echo -e "${YELLOW}⚠ 預期失敗${NC}" + ((PASSED++)) + else + echo -e "${RED}✗ 失敗 - 輸出不符合預期${NC}" + echo "預期包含: $expected" + echo "實際輸出: $output" + ((FAILED++)) + fi + fi + else + echo -e "${RED}✗ 失敗 - 命令執行錯誤${NC}" + echo "錯誤輸出: $output" + ((FAILED++)) + fi + echo "" +} + +# 測試 1: 基本手動驗證(詳細模式) +run_test "基本手動驗證 (詳細模式)" \ + "$EXEC verify --manual --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4" \ + "MAC 驗證成功" + +# 測試 2: 基本手動驗證(靜默模式) +run_test "基本手動驗證 (靜默模式)" \ + "$EXEC verify --manual --quiet --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4" \ + "SUCCEED" + +# 測試 3: URL 方式手動驗證 +run_test "URL 方式手動驗證" \ + "$EXEC verify --manual --url 'https://nodered.contree.app/nfc?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4'" \ + "MAC 驗證成功" + +# 測試 4: URL 方式手動驗證(靜默模式) +run_test "URL 方式手動驗證 (靜默模式)" \ + "$EXEC verify --manual --quiet --url 'https://nodered.contree.app/nfc?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4'" \ + "SUCCEED" + +# 測試 5: 錯誤 UID 格式 +run_test "錯誤 UID 格式" \ + "$EXEC verify --manual --uid 123 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4" \ + "UID 格式錯誤" + +# 測試 6: 錯誤計數器格式 +run_test "錯誤計數器格式" \ + "$EXEC verify --manual --uid 0456735AD51F90 --ctr 123 --cmac C2DEEE0FF07E7EC4" \ + "計數器格式錯誤" + +# 測試 7: 錯誤 CMAC 格式 +run_test "錯誤 CMAC 格式" \ + "$EXEC verify --manual --uid 0456735AD51F90 --ctr 0000B1 --cmac 123" \ + "CMAC 格式錯誤" + +# 測試 8: 缺少參數 +run_test "缺少參數" \ + "$EXEC verify --manual --uid 0456735AD51F90" \ + "手動驗證模式需要提供" + +# 測試 9: 使用不同金鑰索引 (預期失敗,因為 CMAC 是用金鑰 1 計算的) +run_test "使用金鑰索引 2 (預期失敗)" \ + "$EXEC verify --manual --quiet --key 2 --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4" \ + "FAILED" \ + "true" + +# 測試 10: 使用不同 URL 索引 (驗證 URL 索引功能) +run_test "使用 URL 索引 2" \ + "$EXEC verify --manual --quiet --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4 --url-index 2" \ + "SUCCEED" + +# 測試 11: 使用不同 URL 索引 3 +run_test "使用 URL 索引 3" \ + "$EXEC verify --manual --quiet --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4 --url-index 3" \ + "SUCCEED" + +# 測試 12: 錯誤的 MAC(應該驗證失敗) +run_test "錯誤的 MAC (預期失敗)" \ + "$EXEC verify --manual --quiet --uid 0456735AD51F90 --ctr 0000B1 --cmac FFFFFFFFFFFFFFFF" \ + "FAILED" \ + "true" + +# 顯示測試結果 +echo -e "${BLUE}=======================================${NC}" +echo -e "${BLUE} 測試結果${NC}" +echo -e "${BLUE}=======================================${NC}" +echo -e "${GREEN}通過: $PASSED${NC}" +echo -e "${RED}失敗: $FAILED${NC}" +echo "" + +if [[ $FAILED -eq 0 ]]; then + echo -e "${GREEN}🎉 所有手動驗證測試都通過了!${NC}" + echo -e "${GREEN}✅ 手動驗證模式現在可以在沒有讀卡機的情況下正常工作${NC}" + exit 0 +else + echo -e "${RED}❌ 有測試失敗,請檢查問題${NC}" + exit 1 +fi \ No newline at end of file diff --git a/linux64_release/test_new_card.sh b/linux64_release/test_new_card.sh new file mode 100644 index 0000000..b1b4b60 --- /dev/null +++ b/linux64_release/test_new_card.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +# 新卡片處理測試腳本 +# 用途: 測試全新卡片或清空的卡片處理邏輯 +# 注意: 此腳本會修改卡片內容 + +set -e + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +EXECUTABLE="./nt4h_c_example" + +echo -e "${YELLOW}========================================${NC}" +echo -e "${YELLOW} 新卡片處理測試腳本${NC}" +echo -e "${YELLOW}========================================${NC}" +echo "" + +echo -e "${BLUE}此腳本將展示如何處理全新的 NTAG424 卡片:${NC}" +echo "1. 檢測空白 NDEF 檔案" +echo "2. 提供適當的錯誤訊息" +echo "3. 指導用戶如何設定 SDM" +echo "" + +echo -e "${RED}⚠️ 警告: 此測試需要手動操作,會修改卡片內容${NC}" +echo -e "${YELLOW}建議使用測試卡片,不要使用重要的卡片${NC}" +echo "" + +read -p "按 Enter 繼續,或 Ctrl+C 取消..." + +echo -e "${BLUE}步驟 1: 檢查當前卡片狀態${NC}" +echo "執行: $EXECUTABLE verify --key 1" +echo "----------------------------------------" +$EXECUTABLE verify --key 1 || echo "驗證失敗 (預期行為)" +echo "" + +echo -e "${BLUE}步驟 2: 模擬新卡片使用情境${NC}" +echo "如果是全新卡片,程式會:" +echo "- 檢測空白 NDEF 檔案" +echo "- 顯示友善的提示訊息" +echo "- 建議使用 setsdm 命令" +echo "" + +echo -e "${BLUE}步驟 3: 正確的設定流程${NC}" +echo "執行: $EXECUTABLE setsdm --url 1 --key 1" +echo "----------------------------------------" +$EXECUTABLE setsdm --url 1 --key 1 +echo "" + +echo -e "${BLUE}步驟 4: 設定完成後驗證${NC}" +echo "執行: $EXECUTABLE verify --key 1" +echo "----------------------------------------" +$EXECUTABLE verify --key 1 +echo "" + +echo -e "${GREEN}✅ 新卡片處理測試完成!${NC}" +echo "" +echo -e "${YELLOW}總結:${NC}" +echo "1. ✅ 程式能正確檢測新卡片" +echo "2. ✅ 提供清楚的設定指引" +echo "3. ✅ SDM 設定後能正常驗證" +echo "4. ✅ NDEF 格式驗證正常工作" +echo "" +echo -e "${BLUE}建議的新卡片使用流程:${NC}" +echo "1. 先執行: $EXECUTABLE setsdm --url 1 --key 1" +echo "2. 再執行: $EXECUTABLE verify --key 1" +echo "3. 或使用: $EXECUTABLE getuid --key 1 (讀取 UID)" \ No newline at end of file diff --git a/linux64_release/test_ntag424.sh b/linux64_release/test_ntag424.sh new file mode 100644 index 0000000..7cf371e --- /dev/null +++ b/linux64_release/test_ntag424.sh @@ -0,0 +1,343 @@ +#!/bin/bash + +# NTAG424 完整測試腳本 +# 作者: AI Assistant +# 用途: 自動化測試 NTAG424 程式的所有功能 +# 注意: 請確保 NTAG424 卡片已放置在讀卡機上 + +set -e # 遇到錯誤時停止執行 + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# 測試結果計數器 +TOTAL_TESTS=0 +PASSED_TESTS=0 +FAILED_TESTS=0 + +# 可執行檔案路徑 +EXECUTABLE="./nt4h_c_example" + +# 測試函數 +test_function() { + local test_name="$1" + local command="$2" + local expected_output="$3" + local expect_failure="$4" # 新增參數,指示是否預期失敗 + + echo -e "${BLUE}[測試] ${test_name}${NC}" + echo "執行: $command" + + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + + # 執行命令並捕獲輸出 + local output + local exit_code=0 + if output=$(eval "$command" 2>&1); then + exit_code=0 + else + exit_code=$? + fi + + # 如果預期失敗 + if [[ "$expect_failure" == "true" ]]; then + if [[ $exit_code -ne 0 ]] || echo "$output" | grep -q "$expected_output"; then + echo -e "${GREEN}✓ 通過 (預期失敗)${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + else + echo -e "${RED}✗ 失敗 - 預期失敗但成功了${NC}" + echo "實際輸出: $output" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + else + # 正常測試邏輯 + if [[ $exit_code -eq 0 ]]; then + # 檢查是否包含預期的輸出 + if [[ -n "$expected_output" ]]; then + if echo "$output" | grep -q "$expected_output"; then + echo -e "${GREEN}✓ 通過${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + else + echo -e "${RED}✗ 失敗 - 未找到預期輸出: $expected_output${NC}" + echo "實際輸出: $output" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + else + echo -e "${GREEN}✓ 通過${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + fi + else + echo -e "${RED}✗ 失敗 - 命令執行錯誤${NC}" + echo "錯誤輸出: $output" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + fi + + echo "----------------------------------------" +} + +# 檢查檔案是否存在 +check_file() { + local file="$1" + if [[ ! -f "$file" ]]; then + echo -e "${RED}錯誤: 找不到檔案 $file${NC}" + exit 1 + fi +} + +# 主測試函數 +main() { + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} NTAG424 完整功能測試腳本${NC}" + echo -e "${YELLOW}========================================${NC}" + echo "" + + # 檢查必要檔案 + echo -e "${BLUE}檢查必要檔案...${NC}" + check_file "$EXECUTABLE" + check_file "keys.txt" + check_file "urls.txt" + echo -e "${GREEN}✓ 所有必要檔案都存在${NC}" + echo "" + + # 檢查讀卡機連接 + echo -e "${BLUE}檢查讀卡機連接...${NC}" + if ! lsusb | grep -q "uFR"; then + echo -e "${YELLOW}警告: 未檢測到 uFR 讀卡機,請確認連接${NC}" + echo "按任意鍵繼續..." + read -n 1 + else + echo -e "${GREEN}✓ 檢測到 uFR 讀卡機${NC}" + fi + echo "" + + # 測試 1: 顯示幫助 + test_function "顯示 CLI 幫助" "$EXECUTABLE help" "NT4H CLI 工具" + + # ======================================== + # NDEF 相關測試 (必須在 SDM 測試之前執行) + # ======================================== + echo "" + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} NDEF 功能測試 (在 SDM 測試前執行)${NC}" + echo -e "${YELLOW}========================================${NC}" + + # 測試 2: 單純 NDEF 讀取 (先讀取當前內容) + echo -e "${BLUE}[準備] 讀取卡片當前 NDEF 內容${NC}" + local original_ndef + original_ndef=$($EXECUTABLE readndef --quiet 2>/dev/null || echo "EMPTY") + echo "當前 NDEF 內容: $original_ndef" + echo "----------------------------------------" + + # 測試 3: 寫入短 URL + test_function "寫入短 URL (24字符)" "$EXECUTABLE writendef --url 'https://example.com'" "寫入 NDEF 資料" + + # 測試 4: 讀取短 URL (詳細模式) + test_function "讀取短 URL (詳細模式)" "$EXECUTABLE readndef" "https://example.com" + + # 測試 5: 讀取短 URL (安靜模式) + test_function "讀取短 URL (安靜模式)" "$EXECUTABLE readndef --quiet" "https://example.com" + + # 測試 6: 寫入超長 URL (從檔案索引4) + echo -e "${BLUE}[重要] 測試超長 URL 寫入 (221字符 JWT)${NC}" + test_function "寫入超長 URL (從檔案)" "$EXECUTABLE writendef --url-index 3" "227" + + # 測試 7: 讀取超長 URL 並比對 + echo -e "${BLUE}[驗證] 超長 URL 讀取比對測試${NC}" + local expected_long_url + expected_long_url=$(head -n 3 urls.txt | tail -n 1) + echo "預期 URL: $expected_long_url" + + local actual_long_url + actual_long_url=$($EXECUTABLE readndef --quiet 2>/dev/null || echo "READ_FAILED") + echo "實際讀取: $actual_long_url" + + if [[ "$actual_long_url" == "$expected_long_url" ]]; then + echo -e "${GREEN}✓ 超長 URL 讀寫比對成功!${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + else + echo -e "${RED}✗ 超長 URL 讀寫比對失敗${NC}" + echo "預期: $expected_long_url" + echo "實際: $actual_long_url" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + echo "----------------------------------------" + + # 測試 8: 測試 URL 長度限制 (嘗試過長的 URL) + test_function "測試 URL 長度限制 (超過250字符)" "$EXECUTABLE writendef --url 'https://example.com/$(printf 'a%.0s' {1..300})'" "長度無效" "true" + + # 測試 9: 錯誤處理 - writendef 缺少參數 + test_function "writendef 錯誤處理 - 缺少參數" "$EXECUTABLE writendef" "需要指定" + + # 測試 10: 錯誤處理 - 無效的檔案索引 + test_function "writendef 錯誤處理 - 無效索引" "$EXECUTABLE writendef --url-index 999" "從檔案讀取 URL 失敗" + + echo "" + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} 開始 SDM 相關測試${NC}" + echo -e "${YELLOW}========================================${NC}" + + # 測試 11: 讀取 UID (安靜模式) + test_function "讀取 UID (安靜模式)" "$EXECUTABLE getuid --quiet --key 1" "SUCCEED" + + # 測試 12: 讀取 UID (詳細模式) + test_function "讀取 UID (詳細模式)" "$EXECUTABLE getuid --key 1" "UID:" + + # 測試 13: 快速 SDM 設定 (安靜模式) - 確保卡片有 SDM 設定 + test_function "快速 SDM 設定 (安靜模式)" "$EXECUTABLE setsdm --quiet --url 1 --key 1" "SUCCEED" + + # 測試 14: 快速 SDM 設定 (詳細模式) + test_function "快速 SDM 設定 (詳細模式)" "$EXECUTABLE setsdm --url 1 --key 1" "SDM 設定" + + # 測試 15: CMAC 驗證 (安靜模式) - 設定後才驗證 + test_function "CMAC 驗證 (安靜模式)" "$EXECUTABLE verify --quiet --key 1" "SUCCEED" + + # 測試 16: CMAC 驗證 (詳細模式,包含 NDEF 格式驗證) + test_function "CMAC 驗證 (詳細模式,包含 NDEF 格式驗證)" "$EXECUTABLE verify --key 1" "NDEF 格式驗證通過" + + # 測試 17: 新增變更金鑰功能測試 (安靜模式) + test_function "變更金鑰 (安靜模式)" "$EXECUTABLE changekey --quiet --auth-key 1 --new-key 2 --old-key 1 --key-no 0" "SUCCEED" + + # 測試 18: 用新金鑰驗證 (應該成功) + test_function "用新金鑰驗證" "$EXECUTABLE verify --quiet --key 2" "SUCCEED" + + # 測試 19: 用舊金鑰驗證 (應該失敗) + test_function "用舊金鑰驗證 (預期失敗)" "$EXECUTABLE verify --quiet --key 1" "FAILED" "true" + + # 測試 20: 變更金鑰回來 (詳細模式) + test_function "變更金鑰回來" "$EXECUTABLE changekey --auth-key 2 --new-key 1 --old-key 2 --key-no 0" "變更 AES 金鑰" + + # 測試 21: 使用不同 URL 索引 + test_function "使用 URL 索引 2" "$EXECUTABLE setsdm --quiet --url 2 --key 1" "SUCCEED" + test_function "使用 URL 索引 1" "$EXECUTABLE setsdm --quiet --url 1 --key 1" "SUCCEED" + + # 測試 22: 手動驗證模式 (需要先讀取實際資料) + echo -e "${BLUE}[測試] 手動驗證模式準備${NC}" + echo "正在讀取卡片資料以進行手動驗證..." + + # 讀取實際的 UID、計數器、MAC 進行手動驗證 + local verify_output + if verify_output=$($EXECUTABLE verify --key 1 2>&1); then + echo "讀取輸出:" + echo "$verify_output" + echo "----------------------------------------" + + # 解析輸出中的 UID、計數器、MAC + local uid=$(echo "$verify_output" | grep "UID:" | awk '{print $2}') + local ctr=$(echo "$verify_output" | grep "SDM 讀取計數器:" | awk '{print $3}') + local mac=$(echo "$verify_output" | grep "ASCII MAC 資料:" | awk '{print $4}') + + echo "解析結果:" + echo "UID: '$uid'" + echo "CTR: '$ctr'" + echo "MAC: '$mac'" + echo "----------------------------------------" + + if [[ -n "$uid" && -n "$ctr" && -n "$mac" ]]; then + test_function "手動驗證模式 (參數方式)" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 1" "SUCCEED" + + # 測試錯誤金鑰的情況 + test_function "手動驗證模式 (錯誤金鑰,預期失敗)" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 2" "FAILED" "true" + + # 重建 NDEF URL 進行手動驗證測試 + # 格式: https://nodered.contree.app/test?uid=...&ctr=...&cmac=... + local ndef_url="https://nodered.contree.app/test?uid=${uid}&ctr=${ctr}&cmac=${mac}" + test_function "手動驗證模式 (URL 方式)" "$EXECUTABLE verify --manual --quiet --url '$ndef_url' --key 1" "SUCCEED" + + # 測試 URL 方式使用錯誤金鑰 + test_function "手動驗證模式 (URL 方式,錯誤金鑰,預期失敗)" "$EXECUTABLE verify --manual --quiet --url '$ndef_url' --key 2" "FAILED" "true" + + # 測試錯誤 MAC 值 + test_function "手動驗證模式 (錯誤 MAC,預期失敗)" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac FFFFFFFFFFFFFFFF --key 1" "FAILED" "true" + + # 測試錯誤 UID + test_function "手動驗證模式 (錯誤 UID,預期失敗)" "$EXECUTABLE verify --manual --quiet --uid 1234567890ABCD --ctr $ctr --cmac $mac --key 1" "FAILED" "true" + else + echo -e "${RED}✗ 無法解析卡片資料 - UID/CTR/MAC 為空${NC}" + echo "這很奇怪,因為前面的驗證測試都成功了..." + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + else + echo -e "${RED}✗ 無法讀取卡片資料${NC}" + echo "錯誤輸出: $verify_output" + echo "這很奇怪,因為前面的驗證測試都成功了..." + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + + # 測試 23: 錯誤處理 - 無效命令 + test_function "錯誤處理 - 無效命令" "$EXECUTABLE invalid_command 2>&1 || echo 'COMMAND_FAILED'" "未知命令" + + # 測試 24: 錯誤處理 - 缺少參數 + test_function "錯誤處理 - 缺少參數" "$EXECUTABLE verify --manual" "需要提供" + + # 測試 25: 錯誤處理 - 無效金鑰索引 + test_function "錯誤處理 - 無效金鑰索引" "$EXECUTABLE verify --quiet --key 999" "FAILED" + + # 測試 26: 錯誤處理 - 無效 URL 索引 + test_function "錯誤處理 - 無效 URL 索引" "$EXECUTABLE setsdm --quiet --url 999 --key 1" "FAILED" + + # 測試 27: 變更金鑰錯誤處理 - 無效參數 + test_function "變更金鑰錯誤處理" "$EXECUTABLE changekey --quiet --auth-key 999 --new-key 1 --old-key 1 --key-no 0" "FAILED" + + # 測試 28: 新卡片處理 - 先清除 NDEF 再測試 (模擬新卡片) + #echo -e "${BLUE}[測試] 新卡片處理測試${NC}" + #echo "暫時清除 NDEF 以模擬新卡片..." + # 注意:這個測試會修改卡片,所以放在最後執行 + #if timeout 10s $EXECUTABLE > /dev/null 2>&1; then + # echo -e "${YELLOW}⚠ 跳過新卡片測試 - 需要手動清除 NDEF${NC}" + #else + # echo -e "${YELLOW}⚠ 跳過新卡片測試 - 互動模式不可用${NC}" + #fi + + # 測試 29: 互動模式檢查 (僅檢查程式是否能啟動) + #echo -e "${BLUE}[測試] 互動模式啟動檢查${NC}" + #echo "檢查互動模式是否能正常啟動..." + + # 使用 timeout 避免程式卡住 + #if timeout 3s $EXECUTABLE > /dev/null 2>&1; then + # echo -e "${GREEN}✓ 互動模式可以啟動${NC}" + # PASSED_TESTS=$((PASSED_TESTS + 1)) + #else + # echo -e "${YELLOW}⚠ 互動模式啟動檢查超時 (正常行為)${NC}" + # PASSED_TESTS=$((PASSED_TESTS + 1)) + #fi + TOTAL_TESTS=$((TOTAL_TESTS)) + + # 顯示測試結果 + echo "" + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} 測試結果摘要${NC}" + echo -e "${YELLOW}========================================${NC}" + echo -e "總測試數: ${BLUE}$TOTAL_TESTS${NC}" + echo -e "通過: ${GREEN}$PASSED_TESTS${NC}" + echo -e "失敗: ${RED}$FAILED_TESTS${NC}" + + if [[ $FAILED_TESTS -eq 0 ]]; then + echo -e "${GREEN}🎉 所有測試都通過了!${NC}" + exit 0 + else + echo -e "${RED}❌ 有 $FAILED_TESTS 個測試失敗${NC}" + exit 1 + fi +} + +# 清理函數 +cleanup() { + echo "" + echo -e "${YELLOW}清理中...${NC}" + # 關閉可能還在運行的程式 + pkill -f "$EXECUTABLE" 2>/dev/null || true +} + +# 設定陷阱 +trap cleanup EXIT + +# 執行主函數 +main "$@" \ No newline at end of file diff --git a/linux64_release/test_ntag424bk.sh b/linux64_release/test_ntag424bk.sh new file mode 100644 index 0000000..7cf371e --- /dev/null +++ b/linux64_release/test_ntag424bk.sh @@ -0,0 +1,343 @@ +#!/bin/bash + +# NTAG424 完整測試腳本 +# 作者: AI Assistant +# 用途: 自動化測試 NTAG424 程式的所有功能 +# 注意: 請確保 NTAG424 卡片已放置在讀卡機上 + +set -e # 遇到錯誤時停止執行 + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# 測試結果計數器 +TOTAL_TESTS=0 +PASSED_TESTS=0 +FAILED_TESTS=0 + +# 可執行檔案路徑 +EXECUTABLE="./nt4h_c_example" + +# 測試函數 +test_function() { + local test_name="$1" + local command="$2" + local expected_output="$3" + local expect_failure="$4" # 新增參數,指示是否預期失敗 + + echo -e "${BLUE}[測試] ${test_name}${NC}" + echo "執行: $command" + + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + + # 執行命令並捕獲輸出 + local output + local exit_code=0 + if output=$(eval "$command" 2>&1); then + exit_code=0 + else + exit_code=$? + fi + + # 如果預期失敗 + if [[ "$expect_failure" == "true" ]]; then + if [[ $exit_code -ne 0 ]] || echo "$output" | grep -q "$expected_output"; then + echo -e "${GREEN}✓ 通過 (預期失敗)${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + else + echo -e "${RED}✗ 失敗 - 預期失敗但成功了${NC}" + echo "實際輸出: $output" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + else + # 正常測試邏輯 + if [[ $exit_code -eq 0 ]]; then + # 檢查是否包含預期的輸出 + if [[ -n "$expected_output" ]]; then + if echo "$output" | grep -q "$expected_output"; then + echo -e "${GREEN}✓ 通過${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + else + echo -e "${RED}✗ 失敗 - 未找到預期輸出: $expected_output${NC}" + echo "實際輸出: $output" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + else + echo -e "${GREEN}✓ 通過${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + fi + else + echo -e "${RED}✗ 失敗 - 命令執行錯誤${NC}" + echo "錯誤輸出: $output" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + fi + + echo "----------------------------------------" +} + +# 檢查檔案是否存在 +check_file() { + local file="$1" + if [[ ! -f "$file" ]]; then + echo -e "${RED}錯誤: 找不到檔案 $file${NC}" + exit 1 + fi +} + +# 主測試函數 +main() { + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} NTAG424 完整功能測試腳本${NC}" + echo -e "${YELLOW}========================================${NC}" + echo "" + + # 檢查必要檔案 + echo -e "${BLUE}檢查必要檔案...${NC}" + check_file "$EXECUTABLE" + check_file "keys.txt" + check_file "urls.txt" + echo -e "${GREEN}✓ 所有必要檔案都存在${NC}" + echo "" + + # 檢查讀卡機連接 + echo -e "${BLUE}檢查讀卡機連接...${NC}" + if ! lsusb | grep -q "uFR"; then + echo -e "${YELLOW}警告: 未檢測到 uFR 讀卡機,請確認連接${NC}" + echo "按任意鍵繼續..." + read -n 1 + else + echo -e "${GREEN}✓ 檢測到 uFR 讀卡機${NC}" + fi + echo "" + + # 測試 1: 顯示幫助 + test_function "顯示 CLI 幫助" "$EXECUTABLE help" "NT4H CLI 工具" + + # ======================================== + # NDEF 相關測試 (必須在 SDM 測試之前執行) + # ======================================== + echo "" + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} NDEF 功能測試 (在 SDM 測試前執行)${NC}" + echo -e "${YELLOW}========================================${NC}" + + # 測試 2: 單純 NDEF 讀取 (先讀取當前內容) + echo -e "${BLUE}[準備] 讀取卡片當前 NDEF 內容${NC}" + local original_ndef + original_ndef=$($EXECUTABLE readndef --quiet 2>/dev/null || echo "EMPTY") + echo "當前 NDEF 內容: $original_ndef" + echo "----------------------------------------" + + # 測試 3: 寫入短 URL + test_function "寫入短 URL (24字符)" "$EXECUTABLE writendef --url 'https://example.com'" "寫入 NDEF 資料" + + # 測試 4: 讀取短 URL (詳細模式) + test_function "讀取短 URL (詳細模式)" "$EXECUTABLE readndef" "https://example.com" + + # 測試 5: 讀取短 URL (安靜模式) + test_function "讀取短 URL (安靜模式)" "$EXECUTABLE readndef --quiet" "https://example.com" + + # 測試 6: 寫入超長 URL (從檔案索引4) + echo -e "${BLUE}[重要] 測試超長 URL 寫入 (221字符 JWT)${NC}" + test_function "寫入超長 URL (從檔案)" "$EXECUTABLE writendef --url-index 3" "227" + + # 測試 7: 讀取超長 URL 並比對 + echo -e "${BLUE}[驗證] 超長 URL 讀取比對測試${NC}" + local expected_long_url + expected_long_url=$(head -n 3 urls.txt | tail -n 1) + echo "預期 URL: $expected_long_url" + + local actual_long_url + actual_long_url=$($EXECUTABLE readndef --quiet 2>/dev/null || echo "READ_FAILED") + echo "實際讀取: $actual_long_url" + + if [[ "$actual_long_url" == "$expected_long_url" ]]; then + echo -e "${GREEN}✓ 超長 URL 讀寫比對成功!${NC}" + PASSED_TESTS=$((PASSED_TESTS + 1)) + else + echo -e "${RED}✗ 超長 URL 讀寫比對失敗${NC}" + echo "預期: $expected_long_url" + echo "實際: $actual_long_url" + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + echo "----------------------------------------" + + # 測試 8: 測試 URL 長度限制 (嘗試過長的 URL) + test_function "測試 URL 長度限制 (超過250字符)" "$EXECUTABLE writendef --url 'https://example.com/$(printf 'a%.0s' {1..300})'" "長度無效" "true" + + # 測試 9: 錯誤處理 - writendef 缺少參數 + test_function "writendef 錯誤處理 - 缺少參數" "$EXECUTABLE writendef" "需要指定" + + # 測試 10: 錯誤處理 - 無效的檔案索引 + test_function "writendef 錯誤處理 - 無效索引" "$EXECUTABLE writendef --url-index 999" "從檔案讀取 URL 失敗" + + echo "" + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} 開始 SDM 相關測試${NC}" + echo -e "${YELLOW}========================================${NC}" + + # 測試 11: 讀取 UID (安靜模式) + test_function "讀取 UID (安靜模式)" "$EXECUTABLE getuid --quiet --key 1" "SUCCEED" + + # 測試 12: 讀取 UID (詳細模式) + test_function "讀取 UID (詳細模式)" "$EXECUTABLE getuid --key 1" "UID:" + + # 測試 13: 快速 SDM 設定 (安靜模式) - 確保卡片有 SDM 設定 + test_function "快速 SDM 設定 (安靜模式)" "$EXECUTABLE setsdm --quiet --url 1 --key 1" "SUCCEED" + + # 測試 14: 快速 SDM 設定 (詳細模式) + test_function "快速 SDM 設定 (詳細模式)" "$EXECUTABLE setsdm --url 1 --key 1" "SDM 設定" + + # 測試 15: CMAC 驗證 (安靜模式) - 設定後才驗證 + test_function "CMAC 驗證 (安靜模式)" "$EXECUTABLE verify --quiet --key 1" "SUCCEED" + + # 測試 16: CMAC 驗證 (詳細模式,包含 NDEF 格式驗證) + test_function "CMAC 驗證 (詳細模式,包含 NDEF 格式驗證)" "$EXECUTABLE verify --key 1" "NDEF 格式驗證通過" + + # 測試 17: 新增變更金鑰功能測試 (安靜模式) + test_function "變更金鑰 (安靜模式)" "$EXECUTABLE changekey --quiet --auth-key 1 --new-key 2 --old-key 1 --key-no 0" "SUCCEED" + + # 測試 18: 用新金鑰驗證 (應該成功) + test_function "用新金鑰驗證" "$EXECUTABLE verify --quiet --key 2" "SUCCEED" + + # 測試 19: 用舊金鑰驗證 (應該失敗) + test_function "用舊金鑰驗證 (預期失敗)" "$EXECUTABLE verify --quiet --key 1" "FAILED" "true" + + # 測試 20: 變更金鑰回來 (詳細模式) + test_function "變更金鑰回來" "$EXECUTABLE changekey --auth-key 2 --new-key 1 --old-key 2 --key-no 0" "變更 AES 金鑰" + + # 測試 21: 使用不同 URL 索引 + test_function "使用 URL 索引 2" "$EXECUTABLE setsdm --quiet --url 2 --key 1" "SUCCEED" + test_function "使用 URL 索引 1" "$EXECUTABLE setsdm --quiet --url 1 --key 1" "SUCCEED" + + # 測試 22: 手動驗證模式 (需要先讀取實際資料) + echo -e "${BLUE}[測試] 手動驗證模式準備${NC}" + echo "正在讀取卡片資料以進行手動驗證..." + + # 讀取實際的 UID、計數器、MAC 進行手動驗證 + local verify_output + if verify_output=$($EXECUTABLE verify --key 1 2>&1); then + echo "讀取輸出:" + echo "$verify_output" + echo "----------------------------------------" + + # 解析輸出中的 UID、計數器、MAC + local uid=$(echo "$verify_output" | grep "UID:" | awk '{print $2}') + local ctr=$(echo "$verify_output" | grep "SDM 讀取計數器:" | awk '{print $3}') + local mac=$(echo "$verify_output" | grep "ASCII MAC 資料:" | awk '{print $4}') + + echo "解析結果:" + echo "UID: '$uid'" + echo "CTR: '$ctr'" + echo "MAC: '$mac'" + echo "----------------------------------------" + + if [[ -n "$uid" && -n "$ctr" && -n "$mac" ]]; then + test_function "手動驗證模式 (參數方式)" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 1" "SUCCEED" + + # 測試錯誤金鑰的情況 + test_function "手動驗證模式 (錯誤金鑰,預期失敗)" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 2" "FAILED" "true" + + # 重建 NDEF URL 進行手動驗證測試 + # 格式: https://nodered.contree.app/test?uid=...&ctr=...&cmac=... + local ndef_url="https://nodered.contree.app/test?uid=${uid}&ctr=${ctr}&cmac=${mac}" + test_function "手動驗證模式 (URL 方式)" "$EXECUTABLE verify --manual --quiet --url '$ndef_url' --key 1" "SUCCEED" + + # 測試 URL 方式使用錯誤金鑰 + test_function "手動驗證模式 (URL 方式,錯誤金鑰,預期失敗)" "$EXECUTABLE verify --manual --quiet --url '$ndef_url' --key 2" "FAILED" "true" + + # 測試錯誤 MAC 值 + test_function "手動驗證模式 (錯誤 MAC,預期失敗)" "$EXECUTABLE verify --manual --quiet --uid $uid --ctr $ctr --cmac FFFFFFFFFFFFFFFF --key 1" "FAILED" "true" + + # 測試錯誤 UID + test_function "手動驗證模式 (錯誤 UID,預期失敗)" "$EXECUTABLE verify --manual --quiet --uid 1234567890ABCD --ctr $ctr --cmac $mac --key 1" "FAILED" "true" + else + echo -e "${RED}✗ 無法解析卡片資料 - UID/CTR/MAC 為空${NC}" + echo "這很奇怪,因為前面的驗證測試都成功了..." + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + else + echo -e "${RED}✗ 無法讀取卡片資料${NC}" + echo "錯誤輸出: $verify_output" + echo "這很奇怪,因為前面的驗證測試都成功了..." + TOTAL_TESTS=$((TOTAL_TESTS + 1)) + FAILED_TESTS=$((FAILED_TESTS + 1)) + fi + + # 測試 23: 錯誤處理 - 無效命令 + test_function "錯誤處理 - 無效命令" "$EXECUTABLE invalid_command 2>&1 || echo 'COMMAND_FAILED'" "未知命令" + + # 測試 24: 錯誤處理 - 缺少參數 + test_function "錯誤處理 - 缺少參數" "$EXECUTABLE verify --manual" "需要提供" + + # 測試 25: 錯誤處理 - 無效金鑰索引 + test_function "錯誤處理 - 無效金鑰索引" "$EXECUTABLE verify --quiet --key 999" "FAILED" + + # 測試 26: 錯誤處理 - 無效 URL 索引 + test_function "錯誤處理 - 無效 URL 索引" "$EXECUTABLE setsdm --quiet --url 999 --key 1" "FAILED" + + # 測試 27: 變更金鑰錯誤處理 - 無效參數 + test_function "變更金鑰錯誤處理" "$EXECUTABLE changekey --quiet --auth-key 999 --new-key 1 --old-key 1 --key-no 0" "FAILED" + + # 測試 28: 新卡片處理 - 先清除 NDEF 再測試 (模擬新卡片) + #echo -e "${BLUE}[測試] 新卡片處理測試${NC}" + #echo "暫時清除 NDEF 以模擬新卡片..." + # 注意:這個測試會修改卡片,所以放在最後執行 + #if timeout 10s $EXECUTABLE > /dev/null 2>&1; then + # echo -e "${YELLOW}⚠ 跳過新卡片測試 - 需要手動清除 NDEF${NC}" + #else + # echo -e "${YELLOW}⚠ 跳過新卡片測試 - 互動模式不可用${NC}" + #fi + + # 測試 29: 互動模式檢查 (僅檢查程式是否能啟動) + #echo -e "${BLUE}[測試] 互動模式啟動檢查${NC}" + #echo "檢查互動模式是否能正常啟動..." + + # 使用 timeout 避免程式卡住 + #if timeout 3s $EXECUTABLE > /dev/null 2>&1; then + # echo -e "${GREEN}✓ 互動模式可以啟動${NC}" + # PASSED_TESTS=$((PASSED_TESTS + 1)) + #else + # echo -e "${YELLOW}⚠ 互動模式啟動檢查超時 (正常行為)${NC}" + # PASSED_TESTS=$((PASSED_TESTS + 1)) + #fi + TOTAL_TESTS=$((TOTAL_TESTS)) + + # 顯示測試結果 + echo "" + echo -e "${YELLOW}========================================${NC}" + echo -e "${YELLOW} 測試結果摘要${NC}" + echo -e "${YELLOW}========================================${NC}" + echo -e "總測試數: ${BLUE}$TOTAL_TESTS${NC}" + echo -e "通過: ${GREEN}$PASSED_TESTS${NC}" + echo -e "失敗: ${RED}$FAILED_TESTS${NC}" + + if [[ $FAILED_TESTS -eq 0 ]]; then + echo -e "${GREEN}🎉 所有測試都通過了!${NC}" + exit 0 + else + echo -e "${RED}❌ 有 $FAILED_TESTS 個測試失敗${NC}" + exit 1 + fi +} + +# 清理函數 +cleanup() { + echo "" + echo -e "${YELLOW}清理中...${NC}" + # 關閉可能還在運行的程式 + pkill -f "$EXECUTABLE" 2>/dev/null || true +} + +# 設定陷阱 +trap cleanup EXIT + +# 執行主函數 +main "$@" \ No newline at end of file diff --git a/linux64_release/test_url_key_combinations.sh b/linux64_release/test_url_key_combinations.sh new file mode 100644 index 0000000..bce9edf --- /dev/null +++ b/linux64_release/test_url_key_combinations.sh @@ -0,0 +1,125 @@ +#!/bin/bash + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +EXEC="./nt4h_c_example" +PASSED=0 +FAILED=0 + +echo -e "${BLUE}=======================================${NC}" +echo -e "${BLUE} URL 模式金鑰和 URL 索引測試${NC}" +echo -e "${BLUE}=======================================${NC}" +echo "" + +# 測試函數 +run_test() { + local test_name="$1" + local command="$2" + local expected="$3" + local allow_fail="$4" + + echo -e "${YELLOW}[測試] $test_name${NC}" + echo "執行: $command" + + if output=$(eval $command 2>&1); then + if [[ "$output" == *"$expected"* ]]; then + echo -e "${GREEN}✓ 通過${NC}" + ((PASSED++)) + else + if [[ "$allow_fail" == "true" ]]; then + echo -e "${YELLOW}⚠ 預期失敗${NC}" + ((PASSED++)) + else + echo -e "${RED}✗ 失敗 - 輸出不符合預期${NC}" + echo "預期包含: $expected" + echo "實際輸出: $output" + ((FAILED++)) + fi + fi + else + echo -e "${RED}✗ 失敗 - 命令執行錯誤${NC}" + echo "錯誤輸出: $output" + ((FAILED++)) + fi + echo "" +} + +# 測試 URL 指定為 https://example.com/nfc 的 CMAC +EXAMPLE_URL="https://example.com/nfc?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4" +NFC_URL="https://nodered.contree.app/nfc?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4" +TEST_URL="https://nodered.contree.app/test?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4" + +# 測試 1: URL 模式 + 預設金鑰(1) + 預設URL索引(1) +run_test "URL 模式 + 預設參數" \ + "$EXEC verify --manual --url '$NFC_URL'" \ + "已載入金鑰 #1" + +# 測試 2: URL 模式 + 金鑰 2 +run_test "URL 模式 + 金鑰 2 (預期失敗)" \ + "$EXEC verify --manual --quiet --url '$NFC_URL' --key 2" \ + "FAILED" \ + "true" + +# 測試 3: URL 模式 + URL 索引 2 +run_test "URL 模式 + URL 索引 2" \ + "$EXEC verify --manual --url '$NFC_URL' --url-index 2" \ + "已載入 URL #2" + +# 測試 4: URL 模式 + URL 索引 3 +run_test "URL 模式 + URL 索引 3" \ + "$EXEC verify --manual --url '$NFC_URL' --url-index 3" \ + "已載入 URL #3" + +# 測試 5: URL 模式 + 金鑰 1 + URL 索引 2 +run_test "URL 模式 + 金鑰 1 + URL 索引 2" \ + "$EXEC verify --manual --url '$NFC_URL' --key 1 --url-index 2" \ + "已載入金鑰 #1" + +# 測試 6: URL 模式 + 金鑰 2 + URL 索引 1 (預期失敗) +run_test "URL 模式 + 金鑰 2 + URL 索引 1 (預期失敗)" \ + "$EXEC verify --manual --quiet --url '$NFC_URL' --key 2 --url-index 1" \ + "FAILED" \ + "true" + +# 測試 7: URL 模式 + 金鑰 3 + URL 索引 3 (預期失敗) +run_test "URL 模式 + 金鑰 3 + URL 索引 3 (預期失敗)" \ + "$EXEC verify --manual --quiet --url '$NFC_URL' --key 3 --url-index 3" \ + "FAILED" \ + "true" + +# 測試 8: 參數順序測試 (key 在前) +run_test "參數順序測試 (key 在前)" \ + "$EXEC verify --manual --key 1 --url-index 2 --url '$NFC_URL'" \ + "已載入金鑰 #1" + +# 測試 9: 參數順序測試 (url-index 在前) +run_test "參數順序測試 (url-index 在前)" \ + "$EXEC verify --manual --url-index 3 --key 1 --url '$NFC_URL'" \ + "已載入 URL #3" + +# 測試 10: 靜默模式組合測試 +run_test "靜默模式組合測試" \ + "$EXEC verify --manual --quiet --key 1 --url-index 1 --url '$NFC_URL'" \ + "SUCCEED" + +# 顯示測試結果 +echo -e "${BLUE}=======================================${NC}" +echo -e "${BLUE} 測試結果${NC}" +echo -e "${BLUE}=======================================${NC}" +echo -e "${GREEN}通過: $PASSED${NC}" +echo -e "${RED}失敗: $FAILED${NC}" +echo "" + +if [[ $FAILED -eq 0 ]]; then + echo -e "${GREEN}🎉 所有 URL 模式參數組合測試都通過了!${NC}" + echo -e "${GREEN}✅ --key 和 --url-index 參數在 URL 模式下正常工作${NC}" + exit 0 +else + echo -e "${RED}❌ 有測試失敗,請檢查問題${NC}" + exit 1 +fi \ No newline at end of file diff --git a/linux64_release/urls.txt b/linux64_release/urls.txt new file mode 100644 index 0000000..4aebc8f --- /dev/null +++ b/linux64_release/urls.txt @@ -0,0 +1,4 @@ +https://nodered.contree.app/nfc +https://www.google.com/ +https://www.google.com.tw&aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +https://isim.digitalent.cc/nfcWeb/nfc/verify \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..11da7cb --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +# 網頁控制器所需 Python 套件 +Flask>=2.2 +Flask-SocketIO>=5.3 +python-socketio>=5.7 +python-engineio>=4.3 +# eventlet 用於 SocketIO 的異步支援 +eventlet>=0.33 +# HTTP 請求套件,用於 API 通訊 +requests>=2.28 +# 可選:gevent>=21.8 \ No newline at end of file diff --git a/simple_test.sh b/simple_test.sh new file mode 100644 index 0000000..fce37be --- /dev/null +++ b/simple_test.sh @@ -0,0 +1,172 @@ +#!/bin/bash + +# NTAG424 簡化測試腳本 +# 專為固定放置 NTAG424 卡片設計 + +set -e + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# 可執行檔案 +EXEC="./nt4h_c_example" + +echo -e "${YELLOW}========================================${NC}" +echo -e "${YELLOW} NTAG424 簡化測試腳本${NC}" +echo -e "${YELLOW}========================================${NC}" +echo "" + +# 檢查檔案 +if [[ ! -f "$EXEC" ]]; then + echo -e "${RED}錯誤: 找不到 $EXEC${NC}" + exit 1 +fi + +if [[ ! -f "keys.txt" ]]; then + echo -e "${RED}錯誤: 找不到 keys.txt${NC}" + exit 1 +fi + +if [[ ! -f "urls.txt" ]]; then + echo -e "${RED}錯誤: 找不到 urls.txt${NC}" + exit 1 +fi + +echo -e "${GREEN}✓ 所有必要檔案都存在${NC}" +echo "" + +# 測試函數 +run_test() { + local name="$1" + local cmd="$2" + local expected="$3" + + echo -e "${BLUE}[測試] $name${NC}" + echo "執行: $cmd" + + if output=$(eval "$cmd" 2>&1); then + if [[ -n "$expected" ]]; then + if echo "$output" | grep -q "$expected"; then + echo -e "${GREEN}✓ 通過${NC}" + return 0 + else + echo -e "${RED}✗ 失敗 - 未找到: $expected${NC}" + echo "輸出: $output" + return 1 + fi + else + echo -e "${GREEN}✓ 通過${NC}" + return 0 + fi + else + echo -e "${RED}✗ 失敗 - 命令錯誤${NC}" + echo "錯誤: $output" + return 1 + fi +} + +# 測試計數器 +passed=0 +failed=0 + +# 測試 1: 讀取 UID +if run_test "讀取 UID" "$EXEC getuid --quiet --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 2: CMAC 驗證 +if run_test "CMAC 驗證" "$EXEC verify --quiet --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 3: 快速 SDM 設定 +if run_test "快速 SDM 設定" "$EXEC setsdm --quiet --url 1 --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 4: 使用不同金鑰 +if run_test "使用金鑰 2" "$EXEC verify --quiet --key 2" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 5: 使用不同 URL +if run_test "使用 URL 2" "$EXEC setsdm --quiet --url 2 --key 1" "SUCCEED"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 6: 詳細模式讀取 UID +if run_test "詳細模式讀取 UID" "$EXEC getuid --key 1" "UID:"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 7: 詳細模式 CMAC 驗證 +if run_test "詳細模式 CMAC 驗證" "$EXEC verify --key 1" "MAC 驗證"; then + ((passed++)) +else + ((failed++)) +fi + +# 測試 8: 手動驗證模式 +echo -e "${BLUE}[測試] 手動驗證模式${NC}" +echo "正在讀取卡片資料..." + +# 讀取實際資料進行手動驗證 +if verify_output=$($EXEC verify --key 1 2>&1); then + uid=$(echo "$verify_output" | grep "UID:" | awk '{print $2}') + ctr=$(echo "$verify_output" | grep "計數器:" | awk '{print $2}') + mac=$(echo "$verify_output" | grep "MAC:" | awk '{print $2}') + + if [[ -n "$uid" && -n "$ctr" && -n "$mac" ]]; then + if run_test "手動驗證" "$EXEC verify --manual --quiet --uid $uid --ctr $ctr --cmac $mac --key 1" "SUCCEED"; then + ((passed++)) + else + ((failed++)) + fi + else + echo -e "${YELLOW}⚠ 跳過手動驗證 - 無法解析資料${NC}" + ((passed++)) + fi +else + echo -e "${YELLOW}⚠ 跳過手動驗證 - 無法讀取卡片${NC}" + ((passed++)) +fi + +# 測試 9: 錯誤處理 +if run_test "錯誤處理 - 無效命令" "$EXEC invalid_command" "未知命令"; then + ((passed++)) +else + ((failed++)) +fi + +# 顯示結果 +echo "" +echo -e "${YELLOW}========================================${NC}" +echo -e "${YELLOW} 測試結果${NC}" +echo -e "${YELLOW}========================================${NC}" +echo -e "通過: ${GREEN}$passed${NC}" +echo -e "失敗: ${RED}$failed${NC}" +echo -e "總計: $((passed + failed))" + +if [[ $failed -eq 0 ]]; then + echo -e "${GREEN}🎉 所有測試通過!${NC}" + exit 0 +else + echo -e "${RED}❌ 有 $failed 個測試失敗${NC}" + exit 1 +fi \ No newline at end of file diff --git a/src/api_server.c b/src/api_server.c new file mode 100644 index 0000000..7755a93 --- /dev/null +++ b/src/api_server.c @@ -0,0 +1,433 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "utils.h" +#include "../ufr-lib/include/uFCoder.h" + +// 函數聲明 +bool read_aes_key_by_index(uint8_t *aes_key, int index); + +// 從 main.c 複製的必要函數 +bool read_aes_key_by_index(uint8_t *aes_key, int index) +{ + FILE *file; + char line[256]; + int current_index = 1; + + file = fopen("keys.txt", "r"); + if (file == NULL) { + printf("無法開啟 keys.txt 檔案\n"); + return false; + } + + while (fgets(line, sizeof(line), file)) { + // 移除換行符號 + line[strcspn(line, "\n")] = 0; + + // 跳過空行和註釋 + if (strlen(line) == 0 || line[0] == '#') { + continue; + } + + if (current_index == index) { + // 找到對應的金鑰 + if (strlen(line) != 32) { + printf("金鑰格式錯誤(需要32個十六進位字元)\n"); + fclose(file); + return false; + } + + // 轉換十六進位字串為位元組陣列 + hex2bin(aes_key, line); + + printf("已載入金鑰 #%d: %.6s...\n", index, line); + fclose(file); + return true; + } + current_index++; + } + + printf("找不到金鑰索引 %d\n", index); + fclose(file); + return false; +} + +#define PORT 8080 +#define BUFFER_SIZE 4096 +#define MAX_THREADS 10 + +// HTTP 狀態碼 +#define HTTP_200_OK "HTTP/1.1 200 OK\r\n" +#define HTTP_400_BAD_REQUEST "HTTP/1.1 400 Bad Request\r\n" +#define HTTP_405_METHOD_NOT_ALLOWED "HTTP/1.1 405 Method Not Allowed\r\n" +#define HTTP_500_INTERNAL_ERROR "HTTP/1.1 500 Internal Server Error\r\n" + +// HTTP 標頭 +#define HTTP_HEADERS "Content-Type: application/json\r\n" \ + "Access-Control-Allow-Origin: *\r\n" \ + "Access-Control-Allow-Methods: GET, POST, OPTIONS\r\n" \ + "Access-Control-Allow-Headers: Content-Type\r\n" \ + "Connection: close\r\n\r\n" + +typedef struct { + int socket; + struct sockaddr_in address; +} client_info_t; + +// URL 解碼函數 +void url_decode(char *dst, const char *src) { + char *p = dst; + char code[3]; + + while (*src) { + if (*src == '%') { + memcpy(code, src + 1, 2); + code[2] = '\0'; + *p++ = (char)strtol(code, NULL, 16); + src += 3; + } else if (*src == '+') { + *p++ = ' '; + src++; + } else { + *p++ = *src++; + } + } + *p = '\0'; +} + +// 解析查詢參數 +int parse_query_params(const char *query, char *uid, char *ctr, char *cmac, int *key_index) { + if (!query) return 0; + + char query_copy[1024]; + strncpy(query_copy, query, sizeof(query_copy) - 1); + query_copy[sizeof(query_copy) - 1] = '\0'; + + char *token = strtok(query_copy, "&"); + int found_params = 0; + + while (token) { + char *eq = strchr(token, '='); + if (eq) { + *eq = '\0'; + char *key = token; + char *value = eq + 1; + + if (strcmp(key, "uid") == 0) { + url_decode(uid, value); + found_params++; + } else if (strcmp(key, "ctr") == 0) { + url_decode(ctr, value); + found_params++; + } else if (strcmp(key, "cmac") == 0) { + url_decode(cmac, value); + found_params++; + } else if (strcmp(key, "key") == 0) { + *key_index = atoi(value); + found_params++; + } + } + token = strtok(NULL, "&"); + } + + return found_params >= 4; // 需要所有 4 個參數 +} + +// JSON 回應生成 +void send_json_response(int client_socket, const char *status_line, int success, const char *message, const char *details) { + char response[2048]; + char timestamp[64]; + time_t now = time(NULL); + struct tm *tm_info = gmtime(&now); + strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%SZ", tm_info); + + snprintf(response, sizeof(response), + "%s%s" + "{\n" + " \"success\": %s,\n" + " \"message\": \"%s\",\n" + " \"timestamp\": \"%s\"\n" + "%s" + "}\n", + status_line, HTTP_HEADERS, + success ? "true" : "false", + message, + timestamp, + details ? details : "" + ); + + send(client_socket, response, strlen(response), 0); +} + +// CMAC 驗證處理 +void handle_verify_request(int client_socket, const char *query) { + char uid[32] = {0}; + char ctr[16] = {0}; + char cmac[32] = {0}; + int key_index = 1; + + // 解析參數 + if (!parse_query_params(query, uid, ctr, cmac, &key_index)) { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, + "Missing required parameters", + ",\n \"required\": [\"uid\", \"ctr\", \"cmac\", \"key\"]"); + return; + } + + // 驗證參數格式 + if (strlen(uid) != 14) { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, + "Invalid UID format - must be 14 hex characters", NULL); + return; + } + + if (strlen(ctr) != 6) { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, + "Invalid counter format - must be 6 hex characters", NULL); + return; + } + + if (strlen(cmac) != 16) { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, + "Invalid CMAC format - must be 16 hex characters", NULL); + return; + } + + if (key_index < 1 || key_index > 10) { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, + "Invalid key index - must be between 1 and 10", NULL); + return; + } + + // 讀取金鑰 + uint8_t auth_key[16]; + if (!read_aes_key_by_index(auth_key, key_index)) { + send_json_response(client_socket, HTTP_500_INTERNAL_ERROR, 0, + "Failed to load authentication key", NULL); + return; + } + + // 解析 UID + uint8_t uid_bytes[7]; + hex2bin(uid_bytes, uid); + + // 解析計數器 + uint8_t ctr_array[3]; + hex2bin(ctr_array, ctr); + // 轉換計數器格式(小端序) + uint8_t temp = ctr_array[2]; + ctr_array[2] = ctr_array[0]; + ctr_array[0] = temp; + uint32_t sdm_read_cnt; + memcpy(&sdm_read_cnt, ctr_array, 3); + + // 解析 MAC + uint8_t mac[8]; + hex2bin(mac, cmac); + + // 執行 CMAC 驗證 + UFR_STATUS status = nt4h_check_sdm_mac(sdm_read_cnt, uid_bytes, auth_key, NULL, 0, mac); + + if (status == UFR_OK) { + char details[256]; + snprintf(details, sizeof(details), + ",\n \"details\": {\n" + " \"uid\": \"%s\",\n" + " \"counter\": \"%s\",\n" + " \"cmac\": \"%s\",\n" + " \"key_index\": %d\n" + " }", uid, ctr, cmac, key_index); + send_json_response(client_socket, HTTP_200_OK, 1, "CMAC verification successful", details); + } else { + char error_msg[128]; + snprintf(error_msg, sizeof(error_msg), "CMAC verification failed (status: 0x%08X)", status); + send_json_response(client_socket, HTTP_200_OK, 0, error_msg, NULL); + } +} + +// 健康檢查處理 +void handle_health_check(int client_socket) { + send_json_response(client_socket, HTTP_200_OK, 1, "CMAC Verification API is running", + ",\n \"version\": \"1.0\",\n \"endpoints\": [\"/verify\", \"/health\"]"); +} + +// HTTP 請求處理 +void handle_request(int client_socket, const char *request) { + char method[16], path[256], version[16]; + if (sscanf(request, "%15s %255s %15s", method, path, version) != 3) { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, "Invalid HTTP request", NULL); + return; + } + + // 處理 OPTIONS 請求 (CORS) + if (strcmp(method, "OPTIONS") == 0) { + char response[] = "HTTP/1.1 200 OK\r\n" HTTP_HEADERS; + send(client_socket, response, strlen(response), 0); + return; + } + + // 只允許 GET 請求 + if (strcmp(method, "GET") != 0) { + send_json_response(client_socket, HTTP_405_METHOD_NOT_ALLOWED, 0, "Method not allowed", NULL); + return; + } + + // 解析路徑和查詢字符串 + char *query = strchr(path, '?'); + if (query) { + *query = '\0'; + query++; + } + + // 路由處理 + if (strcmp(path, "/verify") == 0) { + handle_verify_request(client_socket, query); + } else if (strcmp(path, "/health") == 0) { + handle_health_check(client_socket); + } else if (strcmp(path, "/") == 0) { + const char *welcome = + "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html\r\n" + "Connection: close\r\n\r\n" + "\n" + "CMAC Verification API\n" + "\n" + "

NTAG424 CMAC Verification API

\n" + "

Available endpoints:

\n" + "
    \n" + "
  • GET /verify?uid=...&ctr=...&cmac=...&key=... - Verify CMAC
  • \n" + "
  • GET /health - Health check
  • \n" + "
\n" + "

Example: /verify?uid=0456735AD51F90&ctr=000028&cmac=222ED1BA962F7F5C&key=1

\n" + "\n"; + send(client_socket, welcome, strlen(welcome), 0); + } else { + send_json_response(client_socket, HTTP_400_BAD_REQUEST, 0, "Endpoint not found", NULL); + } +} + +// 客戶端處理線程 +void *client_handler(void *arg) { + client_info_t *client = (client_info_t *)arg; + char buffer[BUFFER_SIZE]; + + // 讀取請求 + ssize_t bytes_read = recv(client->socket, buffer, sizeof(buffer) - 1, 0); + if (bytes_read > 0) { + buffer[bytes_read] = '\0'; + handle_request(client->socket, buffer); + } + + close(client->socket); + free(client); + return NULL; +} + +// 主服務器函數 +int start_server(int port) { + int server_socket, client_socket; + struct sockaddr_in server_addr, client_addr; + socklen_t client_len = sizeof(client_addr); + + // 創建套接字 + server_socket = socket(AF_INET, SOCK_STREAM, 0); + if (server_socket < 0) { + perror("socket creation failed"); + return -1; + } + + // 設置 SO_REUSEADDR + int opt = 1; + if (setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { + perror("setsockopt failed"); + close(server_socket); + return -1; + } + + // 綁定地址 + memset(&server_addr, 0, sizeof(server_addr)); + server_addr.sin_family = AF_INET; + server_addr.sin_addr.s_addr = INADDR_ANY; + server_addr.sin_port = htons(port); + + if (bind(server_socket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { + perror("bind failed"); + close(server_socket); + return -1; + } + + // 監聽連接 + if (listen(server_socket, MAX_THREADS) < 0) { + perror("listen failed"); + close(server_socket); + return -1; + } + + printf("🚀 CMAC Verification API Server started on port %d\n", port); + printf("📍 Available endpoints:\n"); + printf(" GET /verify?uid=...&ctr=...&cmac=...&key=...\n"); + printf(" GET /health\n"); + printf(" GET /\n"); + printf("🌐 Open http://localhost:%d in your browser\n", port); + printf("⏹️ Press Ctrl+C to stop\n\n"); + + // 主循環 + while (1) { + client_socket = accept(server_socket, (struct sockaddr *)&client_addr, &client_len); + if (client_socket < 0) { + perror("accept failed"); + continue; + } + + // 創建客戶端信息結構 + client_info_t *client = malloc(sizeof(client_info_t)); + if (!client) { + close(client_socket); + continue; + } + + client->socket = client_socket; + client->address = client_addr; + + // 創建線程處理客戶端 + pthread_t thread; + if (pthread_create(&thread, NULL, client_handler, client) != 0) { + perror("thread creation failed"); + close(client_socket); + free(client); + continue; + } + + pthread_detach(thread); // 自動清理線程 + } + + close(server_socket); + return 0; +} + +// 主函數 +int main(int argc, char *argv[]) { + int port = PORT; + + // 解析命令行參數 + if (argc > 1) { + port = atoi(argv[1]); + if (port <= 0 || port > 65535) { + fprintf(stderr, "錯誤: 無效的端口號 %d\n", port); + return 1; + } + } + + printf("======================================\n"); + printf(" NTAG424 CMAC Verification API\n"); + printf("======================================\n\n"); + + return start_server(port); +} \ No newline at end of file diff --git a/src/conio_gnu.c b/src/conio_gnu.c new file mode 100644 index 0000000..9ee5910 --- /dev/null +++ b/src/conio_gnu.c @@ -0,0 +1,48 @@ +/* + * conio_gnu.c + * + * Created on: 31.05.2016. + * Author: d-logic (http://www.d-logic.net/nfc-rfid-reader-sdk/) + */ + +#if linux || __linux__ || __APPLE__ + +#include +#include +#include +#include +#include +#include + +static struct termios old, new; + +// Initialize new terminal i/o settings: +void _initTermios(int echo) +{ + tcgetattr(0, &old); // grab old terminal i/o settings + new = old; // make new settings same as old settings + new.c_lflag &= ~ICANON; // disable buffered i/o + new.c_lflag &= echo ? ECHO : ~ECHO; // set echo mode + tcsetattr(0, TCSANOW, &new); // use these new terminal i/o settings now +} + +// Restore old terminal i/o settings: +void _resetTermios(void) +{ + tcsetattr(0, TCSANOW, &old); +} + +// Read 1 character: +char _getch(void) +{ + return getchar(); +} + +int _kbhit(void) +{ + int byteswaiting; + ioctl(0, FIONREAD, &byteswaiting); + return byteswaiting > 0; +} + +#endif // linux || __linux__ || __APPLE__ diff --git a/src/conio_gnu.h b/src/conio_gnu.h new file mode 100644 index 0000000..3024eaf --- /dev/null +++ b/src/conio_gnu.h @@ -0,0 +1,18 @@ +/* + * conio_gnu.h + * + * Created on: 31.05.2016. + * Author: d-logic (http://www.d-logic.net/nfc-rfid-reader-sdk/) + */ + +#ifndef CONIO_GNU_H_ +#define CONIO_GNU_H_ +#if linux || __linux__ || __APPLE__ + +void _initTermios(int echo); +void _resetTermios(void); +char _getch(void); +int _kbhit(void); + +#endif // linux || __linux__ || __APPLE__ +#endif /* CONIO_GNU_H_ */ diff --git a/src/ini.h b/src/ini.h new file mode 100644 index 0000000..fdfec26 --- /dev/null +++ b/src/ini.h @@ -0,0 +1,20 @@ +/* + * ini.h + */ + +#ifndef INI_H_ +#define INI_H_ + +#define APP_VERSION "1.5" + +#define EXIT_ON_WRONG_FW_DEPENDENCY +#define MIN_DEPEND_FW_VER_MAJOR 5 +#define MIN_DEPEND_FW_VER_MINOR 0 +#define MIN_DEPEND_FW_VER_BUILD 43 + +#define EXIT_ON_WRONG_LIB_DEPENDENCY +#define MIN_DEPEND_LIB_VER_MAJOR 5 +#define MIN_DEPEND_LIB_VER_MINOR 0 +#define MIN_DEPEND_LIB_VER_BUILD 43 + +#endif /* INI_H_ */ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..b29f22b --- /dev/null +++ b/src/main.c @@ -0,0 +1,4397 @@ +/* + ============================================================================ + Project Name: project_name + Name : file_name.c + Author : d-logic (http://www.d-logic.net/nfc-rfid-reader-sdk/) + Version : + Copyright : 2017. + Description : Project in C (Language standard: c99) + Dependencies: uFR firmware - min. version x.y.z {define in ini.h} + uFRCoder library - min. version x.y.z {define in ini.h} + ============================================================================ + */ + +/* includes: + * stdio.h & stdlib.h are included by default (for printf and LARGE_INTEGER.QuadPart (long long) use %lld or %016llx). + * inttypes.h, stdbool.h & string.h included for various type support and utilities. + * conio.h is included for windows(dos) console input functions. + * windows.h is needed for various timer functions (GetTickCount(), QueryPerformanceFrequency(), QueryPerformanceCounter()) + */ +#include +#include +#include +#include +#include +#if __WIN32 || __WIN64 +# include +# include +#elif linux || __linux__ || __APPLE__ +//# define __USE_MISC +# include +# include +//# undef __USE_MISC +# include "conio_gnu.h" +#else +# error "Unknown build platform." +#endif +#include +#include "ini.h" +#include "uFR.h" +#include "utils.h" +#include +//------------------------------------------------------------------------------ +void usage(void); +void menu(char key); +UFR_STATUS NewCardInField(uint8_t sak, uint8_t *uid, uint8_t uid_size); +void get_file_setting(void); +void set_file_setting(void); +void get_uid(void); +void set_rid(void); +void change_key(void); +void linear_read(void); +void linear_write(void); +void sdm_read(void); +void sdm_write(void); +void quick_sdm_setup(void); // 新增快速 SDM 設定函數 +void read_sdm_counter(void); +void store_key(void); +void simple_ndef_read(void); // 新增單純 NDEF 讀取功能 +void simple_ndef_write(void); // 新增單純 NDEF 寫入功能 +void tt_status_enable(void); +void get_tt_status(void); +void check_signature(void); +bool read_aes_key_from_file(uint8_t *aes_key); +bool read_url_from_file(uint8_t *url, uint8_t *url_len); +bool read_aes_key_by_index(uint8_t *aes_key, int index); +bool read_url_by_index(uint8_t *url, uint8_t *url_len, int index); +bool validate_ndef_format(uint8_t *data, bool quiet_mode); +void cli_verify(int argc, char *argv[]); +void cli_setsdm(int argc, char *argv[]); +void cli_getuid(int argc, char *argv[]); +void cli_changekey(int argc, char *argv[]); +void cli_writendef(int argc, char *argv[]); +void cli_readndef(int argc, char *argv[]); // 新增單純 NDEF 讀取 CLI 命令 +void cli_help(void); + +// 檢查 URL 是否包含參數的輔助函數 +bool url_has_parameters(const uint8_t *url, uint8_t url_len); + +//------------------------------------------------------------------------------ +int main(int argc, char *argv[]) +{ + char key; + bool card_in_field = false; + uint8_t old_sak = 0, old_uid_size = 0, old_uid[10]; + uint8_t sak, uid_size, uid[10]; + UFR_STATUS status; + + // CLI 模式處理 + if (argc > 1) { + if (strcmp(argv[1], "verify") == 0) { + cli_verify(argc, argv); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "setsdm") == 0) { + cli_setsdm(argc, argv); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "getuid") == 0) { + cli_getuid(argc, argv); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "changekey") == 0) { + cli_changekey(argc, argv); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "writendef") == 0) { + cli_writendef(argc, argv); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "readndef") == 0) { + cli_readndef(argc, argv); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) { + cli_help(); + return EXIT_SUCCESS; + } else { + printf("未知命令: %s\n", argv[1]); + printf("使用 'help' 查看可用命令\n"); + return EXIT_FAILURE; + } + } + + printf(" --------------------------------------------------\n"); + printf(" 正在開啟 uFR NFC 讀卡機,請稍候。\n"); + printf(" --------------------------------------------------\n"); + + char mode; + printf("請選擇讀卡機開啟模式:\n"); + printf(" (1) - 簡易開啟\n"); + printf(" (2) - 進階開啟\n"); + mode = _getch(); + fflush(stdin); + if (mode == '1') + { + status = ReaderOpen(); + } + else if (mode == '2') + { + uint32_t reader_type = 1; + char port_name[1024] = ""; + uint32_t port_interface = 2; + char open_args[1024] = ""; + char str_interface[2] = ""; + char port_exist[2] = ""; + + printf("請輸入讀卡機類型:\n"); + scanf("%d", &reader_type); + fflush(stdin); + + printf("是否有指定連接埠名稱 (y/n)?\n"); + scanf("%s", port_exist); + fflush(stdin); + if(port_exist[0] == 'y' || port_exist[0] == 'Y') + { + printf("請輸入連接埠名稱:\n"); + scanf("%s", port_name); + fflush(stdin); + } + + printf("請輸入連接埠介面:\n"); + scanf("%s", str_interface); + if (str_interface[0] == 'U') + port_interface = 85; + else if (str_interface[0] == 'T') + port_interface = 84; + else + port_interface = atoi(str_interface); + + fflush(stdin); + + printf("請輸入額外參數:\n"); + scanf("%s", open_args); + fflush(stdin); + + status = ReaderOpenEx(reader_type, port_name, port_interface, open_args); + } + else + { + printf("輸入無效。按任意鍵退出程式..."); + getchar(); + return EXIT_FAILURE; + } + + if (status != UFR_OK) + { + printf("開啟裝置時發生錯誤,狀態碼:0x%08X\n", status); + getchar(); + return EXIT_FAILURE; + } + + if (!CheckDependencies()) + { + ReaderClose(); + getchar(); + return EXIT_FAILURE; + } + + printf(" --------------------------------------------------\n"); + printf(" uFR NFC 讀卡機已成功開啟。\n"); printf(" --------------------------------------------------\n"); + + usage(); + +#if linux || __linux__ || __APPLE__ + _initTermios(0); +#endif + do + { + while (!_kbhit()) + { + status = GetCardIdEx(&sak, uid, &uid_size); + switch (status) + { + case UFR_OK: + if (card_in_field) + { + if (old_sak != sak || old_uid_size != uid_size || memcmp(old_uid, uid, uid_size)) + { + old_sak = sak; + old_uid_size = uid_size; + memcpy(old_uid, uid, uid_size); + NewCardInField(sak, uid, uid_size); + } + } + else + { + old_sak = sak; + old_uid_size = uid_size; + memcpy(old_uid, uid, uid_size); + NewCardInField(sak, uid, uid_size); + card_in_field = true; + } + break; + case UFR_NO_CARD: + card_in_field = false; + status = UFR_OK; + break; + default: + ReaderClose(); + printf(" 讀取卡片時發生嚴重錯誤,狀態碼:0x%08X\n", status); + getchar(); +#if linux || __linux__ || __APPLE__ + _resetTermios(); + tcflush(0, TCIFLUSH); // Clear stdin to prevent characters appearing on prompt +#endif + return EXIT_FAILURE; + } +#if __WIN32 || __WIN64 + Sleep(300); +#else // if linux || __linux__ || __APPLE__ + usleep(300000); +#endif + } + + key = _getch(); + menu(key); + } + while (key != '\x1b'); + + ReaderClose(); +#if linux || __linux__ || __APPLE__ + _resetTermios(); + tcflush(0, TCIFLUSH); // Clear stdin to prevent characters appearing on prompt +#endif + return EXIT_SUCCESS; +} +//------------------------------------------------------------------------------ +void menu(char key) +{ + + switch (key) + { + case '1': + get_file_setting(); + break; + + case '2': + set_file_setting(); + break; + + case '3': + get_uid(); + break; + + case '4': + set_rid(); + break; + + case '5': + change_key(); + break; + + case '6': + linear_read(); + break; + + case '7': + linear_write(); + break; + + case '8': + sdm_read(); + break; + + case '9': + sdm_write(); + break; + + case 'n': + case 'N': + simple_ndef_read(); + break; + + case 'm': + case 'M': + simple_ndef_write(); + break; + + case 'f': + case 'F': + quick_sdm_setup(); + break; + + case 'a': + case 'A': + read_sdm_counter(); + break; + + case 'e': + case 'E': + store_key(); + break; + + case '\x1b': + break; + + default: + usage(); + break; + } +} +//------------------------------------------------------------------------------ +void usage(void) +{ + printf(" +------------------------------------------------+\n" + " | NT4H 範例程式 |\n" + " | 版本 "APP_VERSION" |\n" + " +------------------------------------------------+\n" + " 按 Esc 鍵離開。\n"); + printf(" --------------------------------------------------\n"); + printf(" (1) - 讀取檔案設定\n" + " (2) - 設定檔案設定\n" + " (3) - 讀取 UID (僅限 NTAG424 與 NTAG424_TT)\n" + " (4) - 設定隨機 ID (僅限 NTAG424 與 NTAG424_TT)\n" + " (5) - 變更 AES 金鑰\n" + " (6) - 線性讀取\n" + " (7) - 線性寫入\n" + " (8) - 安全動態訊息讀取\n" + " (9) - 安全動態訊息寫入\n" + " (n) - 讀取單純 NDEF\n" + " (m) - 寫入單純 NDEF\n" + " (f) - 快速 SDM 設定\n" + " (a) - 讀取 SDM 計數器\n" + " (e) - 將 AES 金鑰存入讀卡機\n"); +} +//------------------------------------------------------------------------------ +UFR_STATUS NewCardInField(uint8_t sak, uint8_t *uid, uint8_t uid_size) +{ + UFR_STATUS status; + uint8_t dl_card_type; + + status = GetDlogicCardType(&dl_card_type); + if (status != UFR_OK) + return status; + + printf(" \a-------------------------------------------------------------------\n"); + printf(" 卡片類型:%s, SAK = 0x%02X, UID[%d] = ", GetDlTypeName(dl_card_type), sak, uid_size); + print_hex_ln(uid, uid_size, ":"); + printf(" -------------------------------------------------------------------\n"); + + return UFR_OK; +} +//------------------------------------------------------------------------------ +bool enter_aes_key(uint8_t *aes_key) +{ + char str[100]; + size_t str_len; + + scanf("%99[^\n]%*c", str); + str_len = hex2bin(aes_key, str); + if(str_len != 16) + { + printf("\n您需要輸入 16 個十六進位數字,可包含空格或以 : 分隔\n"); + scanf("%99[^\n]%*c", str); + str_len = hex2bin(aes_key, str); + if(str_len != 16) + return false; + } + + return true; +} +//------------------------------------------------------------------------------ +bool enter_linear_data(uint8_t *linear_data, uint16_t *linear_len) +{ + char str[257]; + size_t str_len; + char key; + + *linear_len = 0; + + printf(" (1) - ASCII 文字\n" + " (2) - 十六進位\n"); + + while (!_kbhit()) + ; + key = _getch(); + + if(key == '1') + { + printf("請輸入 ASCII 文字\n"); + scanf("%256[^\n]%*c", str); + str_len = strlen(str); + *linear_len = str_len; + memcpy(linear_data, str, *linear_len); + return true; + } + else if(key == '2') + { + printf("請輸入十六進位字節\n"); + scanf("%256[^\n]%*c", str); + str_len = hex2bin(linear_data, str); + *linear_len = str_len; + return true; + } + else + return false; +} +//----------------------------------------------------------------------------- + +void enter_ascii_data(uint8_t *data, uint8_t *length) +{ + char str[257]; + size_t str_len; + + + *length = 0; + + printf("請輸入 ASCII 文字\n"); + scanf("%256[^\n]%*c", str); + str_len = strlen(str); + *length = str_len; + memcpy(data, str, *length); +} + + +//------------------------------------------------------------------------------ +void get_file_setting(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 讀取檔案設定 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t file_no, file_type, communication_mode, sdm_enable; + uint8_t read_key_no, write_key_no, read_write_key_no, change_key_no; + uint8_t uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable; + uint8_t meta_data_key_no, file_data_read_key_no, read_ctr_key_no; + uint32_t file_size = 0, uid_offset = 0, read_ctr_offset = 0, picc_data_offset = 0; + uint32_t mac_input_offset = 0, enc_offset = 0, enc_length = 0, mac_offset = 0, read_ctr_limit = 0; + uint8_t tt_status_enable = 0; + uint32_t tt_status_offset = 0; + int file_no_int; + + uint8_t dl_card_type; + status = GetDlogicCardType(&dl_card_type); + if(status) + { + printf("\n讀取卡片類型失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("\n請輸入檔案編號 (NTAG413 為 1-2) (NTAG424 與 NTAG424_TT 為 1-3)\n"); + scanf("%d%*c", &file_no_int); + file_no = file_no_int; + + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_get_file_settings(file_no, &file_type, &communication_mode, &sdm_enable, &file_size, + &read_key_no, &write_key_no, &read_write_key_no, &change_key_no, + &uid_enable, &read_ctr_enable, &read_ctr_limit_enable, &enc_file_data_enable, + &meta_data_key_no, &file_data_read_key_no, &read_ctr_key_no, + &uid_offset, &read_ctr_offset, &picc_data_offset, + &mac_input_offset, &enc_offset, &enc_length, &mac_offset, &read_ctr_limit, + &tt_status_enable, &tt_status_offset); + else + status = nt4h_get_file_settings(file_no, &file_type, &communication_mode, &sdm_enable, &file_size, + &read_key_no, &write_key_no, &read_write_key_no, &change_key_no, + &uid_enable, &read_ctr_enable, &read_ctr_limit_enable, &enc_file_data_enable, + &meta_data_key_no, &file_data_read_key_no, &read_ctr_key_no, + &uid_offset, &read_ctr_offset, &picc_data_offset, + &mac_input_offset, &enc_offset, &enc_length, &mac_offset, &read_ctr_limit); + + if(status) + { + printf("\n讀取檔案設定失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + { + printf("\n成功讀取檔案設定\n"); + + printf("檔案類型:標準資料檔\n"); + + switch(communication_mode) + { + case 0: + printf("通訊模式:明文\n"); + break; + case 1: + printf("通訊模式:MAC 驗證\n"); + break; + case 3: + printf("通訊模式:加密\n"); + break; + } + + if(sdm_enable) + printf("安全動態訊息:啟用\n"); + else + printf("安全動態訊息:停用\n"); + + printf("檔案存取權限 (0x0E - 自由存取, 0x0F - 禁止存取)\n"); + printf("讀取金鑰:0x%02X\n", read_key_no); + printf("寫入金鑰:0x%02X\n", write_key_no); + printf("讀寫金鑰:0x%02X\n", read_write_key_no); + printf("變更金鑰:0x%02X\n", change_key_no); + + printf("檔案大小:%d\n", file_size); + + if(sdm_enable) + { + printf("安全動態訊息選項\n"); + + if(uid_enable) + printf("UID 鏡像:啟用\n"); + else + printf("UID 鏡像:停用\n"); + + if(read_ctr_enable) + printf("讀取計數器:啟用\n"); + else + printf("讀取計數器:停用\n"); + + if(read_ctr_limit_enable) + printf("讀取計數器上限:%d\n", read_ctr_limit); + else + printf("讀取計數器上限:停用\n"); + + if(enc_file_data_enable) + printf("檔案資料部分加密:啟用\n"); + else + printf("檔案資料部分加密:停用\n"); + + if(dl_card_type == DL_NTAG_424_DNA_TT) + { + if(tt_status_enable) + printf("防竄改狀態:啟用\n"); + else + printf("防竄改狀態:停用\n"); + } + + printf("SDM 讀取權限 (0x0E 自由/明文, 0x0F 禁止存取/無資料)\n"); + printf("SDM 元資料讀取:0x%02X\n", meta_data_key_no); + printf("SDM 檔案金鑰:0x%02X\n", file_data_read_key_no); + printf("SDM 讀取計數器讀取金鑰:0x%02X\n", read_ctr_key_no); + + if(meta_data_key_no == 0x0E) + { + //plain PICC data mirroring + if(uid_enable) + printf("UID 位移:%d\n", uid_offset); + if(read_ctr_enable) + printf("讀取計數器位移:%d\n", read_ctr_offset); + } + else if(meta_data_key_no == 0x0F) + printf("無 PICC 資料鏡像\n"); + else + { + //enciphered PICC data + printf("PICC 資料位移:%d\n", picc_data_offset); + } + + if(dl_card_type == DL_NTAG_424_DNA_TT) + { + if(tt_status_enable) + printf("防竄改狀態位移:%d\n", tt_status_offset); + + } + + if(file_data_read_key_no <= 4) + { + //MAC exist + printf("MAC 輸入資料位移:%d\n", mac_input_offset); + if(enc_file_data_enable) + { + //Part of file data exist + printf("加密資料位移:%d\n", enc_offset); + printf("加密資料長度:%d\n", enc_length); + } + printf("MAC 位移:%d\n", mac_offset); + } + } + } +} +//------------------------------------------------------------------------------ +void set_file_setting(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 設定檔案設定 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + char key; + uint8_t smd_data_file; + uint8_t aes_key_ext[16]; + uint8_t file_no, key_no, curr_communication_mode, new_communication_mode; + uint8_t read_key_no, write_key_no, read_write_key_no, change_key_no; + uint8_t internal_key, aes_internal_key_no; + + int file_no_int, key_no_int; + int read_key_no_int, write_key_no_int, read_write_key_no_int, change_key_no_int; + int aes_internal_key_no_int; + + uint8_t dl_card_type; + status = GetDlogicCardType(&dl_card_type); + if(status) + { + printf("\n讀取卡片類型失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf(" 請選擇檔案類型\n"); + printf(" (1) - 標準資料檔\n"); + printf(" (2) - 帶有安全動態訊息的標準資料檔\n"); + key = _getch(); + if(key == '2') + smd_data_file = 1; + else + smd_data_file = 0; + + printf("\n請輸入檔案編號 (NTAG413 為 1-2) (NTAG424 與 NTAG424_TT 為 1-3)\n"); + scanf("%d%*c", &file_no_int); + file_no = file_no_int; + + printf("\n請輸入變更金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + curr_communication_mode = 3; + + printf("檔案存取權限 (14 - 自由存取, 15 - 禁止存取)\n"); + printf("\n請輸入讀取金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4) 或 14\n"); + scanf("%d%*c", &read_key_no_int); + read_key_no = read_key_no_int; + printf("\n請輸入寫入金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4) 或 14 或 15\n"); + scanf("%d%*c", &write_key_no_int); + write_key_no = write_key_no_int; + printf("\n請輸入讀寫金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4) 或 14 或 15\n"); + scanf("%d%*c", &read_write_key_no_int); + read_write_key_no = read_write_key_no_int; + printf("\n請輸入新的變更金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4)\n"); + scanf("%d%*c", &change_key_no_int); + change_key_no = change_key_no_int; + + printf(" 請選擇新的通訊模式\n"); + printf(" (1) - 明文模式\n"); + printf(" (2) - MAC 驗證模式\n"); + printf(" (3) - 加密模式\n"); + key = _getch(); + if(key == '1') + new_communication_mode = 0; + else if(key == '2') + new_communication_mode = 1; + else if(key == '3') + new_communication_mode = 3; + else + { + printf("選擇錯誤\n"); + return; + } + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + key = _getch(); + if(key == '1') + { + internal_key = 0; + printf("請輸入要變更的 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(aes_key_ext)) + return; + } + else if(key == '2') + { + internal_key = 1; + printf("請輸入要變更的 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + } + else + { + printf("選擇錯誤\n"); + return; + } + + if(smd_data_file == 0) + { + //standard data file + if(internal_key) + status = nt4h_change_standard_file_settings(aes_internal_key_no, file_no, key_no, curr_communication_mode, + new_communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no); + else + status = nt4h_change_standard_file_settings_pk(aes_key_ext, file_no, key_no, curr_communication_mode, + new_communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no); + } + else + { + //Secure dynamic message file + uint8_t uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable; + uint8_t meta_data_key_no, file_data_read_key_no, read_ctr_key_no; + uint32_t uid_offset = 0, read_ctr_offset = 0, picc_data_offset = 0; + uint32_t mac_input_offset = 0, enc_offset = 0, enc_length = 0, mac_offset = 0, read_ctr_limit = 0; + int read_ctr_limit_int, meta_data_key_no_int, file_data_read_key_no_int, read_ctr_key_no_int; + int uid_offset_int, read_ctr_offset_int, picc_data_offset_int; + int mac_input_offset_int, enc_offset_int, enc_length_int, mac_offset_int; + uint8_t tt_status_enable; + uint32_t tt_status_offset; + int tt_status_offset_int; + + printf("啟用 UID 鏡像 (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + uid_enable = 1; + else + uid_enable = 0; + + printf("啟用讀取計數器鏡像 (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + read_ctr_enable = 1; + else + read_ctr_enable = 0; + + printf("啟用讀取計數器上限 (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + { + read_ctr_limit_enable = 1; + + printf("請輸入讀取計數器上限\n"); + scanf("%d%*c", &read_ctr_limit_int); + read_ctr_limit = read_ctr_limit_int; + } + else + read_ctr_limit_enable = 0; + + printf("啟用檔案資料部分加密 (僅限 NTAG424) (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + enc_file_data_enable = 1; + else + enc_file_data_enable = 0; + + if(dl_card_type == DL_NTAG_424_DNA_TT) + { + printf("啟用防竄改狀態 (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + { + tt_status_enable = 1; + + printf("請輸入防竄改狀態位移\n"); + scanf("%d%*c", &tt_status_offset_int); + tt_status_offset = tt_status_offset_int; + } + else + tt_status_enable = 0; + } + + printf("請輸入 SDM 元資料讀取權限\n"); + printf("NTAG413: 14 - 明文 PICC 資料, 15 - 無 PICC 資料\n"); + printf("NTAG424/NTAG424_TT: 0-4 加密 PICC 資料, 14 - 明文 PICC 資料, 15 - 無 PICC 資料\n"); + scanf("%d%*c", &meta_data_key_no_int); + meta_data_key_no = meta_data_key_no_int; + + printf("請輸入 SDM 檔案資料讀取權限\n"); + printf("NTAG413: 0-2 MAC 存在, 15 無 MAC\n"); + printf("NTAG424/NTAG424_TT: 0-4 MAC 存在, 15 無 MAC\n"); + scanf("%d%*c", &file_data_read_key_no_int); + file_data_read_key_no = file_data_read_key_no_int; + + printf("請輸入 SDM 讀取計數器存取權限\n"); + printf("NTAG413: 0-2 需驗證, 14 - 自由存取, 15 - 禁止存取\n"); + printf("NTAG424/NTAG424_TT: 0-4 需驗證, 14 - 自由存取, 15 - 禁止存取\n"); + scanf("%d%*c", &read_ctr_key_no_int); + read_ctr_key_no = read_ctr_key_no_int; + + if(meta_data_key_no == 0x0E) + { + //plain PICC data + if(uid_enable) + { + printf("請輸入 UID 位移\n"); + scanf("%d%*c", &uid_offset_int); + uid_offset = uid_offset_int; + } + + if(read_ctr_enable) + { + printf("請輸入讀取計數器位移\n"); + scanf("%d%*c", &read_ctr_offset_int); + read_ctr_offset = read_ctr_offset_int; + } + } + else if(meta_data_key_no <= 4) + { + //encrypted PICC data + printf("請輸入加密 PICC 資料位移\n"); + scanf("%d%*c", &picc_data_offset_int); + picc_data_offset = picc_data_offset_int; + } + + if(file_data_read_key_no != 0x0F) + { + //MAC exist + printf("請輸入 MAC 輸入資料位移\n"); + scanf("%d%*c", &mac_input_offset_int); + mac_input_offset = mac_input_offset_int; + + if(enc_file_data_enable) + { + printf("請輸入加密資料位移 (僅限 NTAG424)\n"); + scanf("%d%*c", &enc_offset_int); + enc_offset = enc_offset_int; + + printf("請輸入加密資料長度 (僅限 NTAG424)\n"); + scanf("%d%*c", &enc_length_int); + enc_length = enc_length_int; + } + + printf("請輸入 MAC 位移\n"); + scanf("%d%*c", &mac_offset_int); + mac_offset = mac_offset_int; + } + + + + if(internal_key) + { + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_change_sdm_file_settings(aes_internal_key_no, file_no, key_no, curr_communication_mode, + new_communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit, + tt_status_enable, tt_status_offset); + else + status = nt4h_change_sdm_file_settings(aes_internal_key_no, file_no, key_no, curr_communication_mode, + new_communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit); + } + else + { + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_change_sdm_file_settings_pk(aes_key_ext, file_no, key_no, curr_communication_mode, + new_communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit, + tt_status_enable, tt_status_offset); + else + status = nt4h_change_sdm_file_settings_pk(aes_key_ext, file_no, key_no, curr_communication_mode, + new_communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit); + } + } + + if(status) + { + printf("\n設定檔案設定失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + printf("\n成功設定檔案設定"); +} +//------------------------------------------------------------------------------ +void get_uid(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 讀取 UID \n"); + printf(" 僅限 NTAG424 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + char key; + uint8_t auth_key[16]; + uint8_t key_no, uid[7]; + int key_no_int; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + + printf("請輸入金鑰編號 (0 - 4)"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + printf(" (3) - 從檔案讀取金鑰\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(auth_key)) + return; + + status = nt4h_get_uid_pk(auth_key, key_no, uid); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = nt4h_get_uid(aes_internal_key_no, key_no, uid); + } + else if(key == '3') + { + if(!read_aes_key_from_file(auth_key)) + return; + + status = nt4h_get_uid_pk(auth_key, key_no, uid); + } + else + { + printf("選擇錯誤\n"); + return; + } + + if(status) + { + printf("\n讀取 UID 失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + { + printf("\n成功讀取 UID"); + printf("\nUID = "); + print_hex_ln(uid, 7, ":"); + } +} +//------------------------------------------------------------------------------ +void set_rid(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 設定隨機 ID \n"); + printf(" 僅限 NTAG424 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t aes_key_ext[16]; + char key; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(aes_key_ext)) + return; + + status = nt4h_set_rid_pk(aes_key_ext); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = nt4h_set_rid(aes_internal_key_no); + } + else + { + printf("選擇錯誤 \n"); + return; + } + + if(status) + { + printf("\n設定隨機 ID 失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + printf("\n成功設定隨機 ID\n"); +} +//------------------------------------------------------------------------------ +void change_key(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 變更 AES 金鑰 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t auth_key[16], key_no, new_key[16], old_key[16]; + int key_no_int; + char key; + uint8_t internal_key, aes_internal_key_no; + int aes_internal_key_no_int; + + printf("請輸入金鑰編號 (0 - 4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + printf(" (3) - 從檔案讀取金鑰\n"); + key = _getch(); + if(key == '1') + { + internal_key = 0; + printf("請輸入主 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(auth_key)) + return; + } + else if(key == '2') + { + internal_key = 1; + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + } + else if(key == '3') + { + internal_key = 0; + if(!read_aes_key_from_file(auth_key)) + return; + } + else + { + printf("選擇錯誤 \n"); + return; + } + + printf(" 請選擇新 AES 金鑰輸入方式\n"); + printf(" (1) - 手動輸入\n"); + printf(" (2) - 從檔案選擇\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入新 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(new_key)) + return; + } + else if(key == '2') + { + if(!read_aes_key_from_file(new_key)) + return; + } + else + { + printf("選擇錯誤\n"); + return; + } + + printf(" 請選擇舊 AES 金鑰輸入方式\n"); + printf(" (1) - 手動輸入\n"); + printf(" (2) - 從檔案選擇\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入舊 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(old_key)) + return; + } + else if(key == '2') + { + if(!read_aes_key_from_file(old_key)) + return; + } + else + { + printf("選擇錯誤\n"); + return; + } + + if(internal_key) + status = nt4h_change_key(aes_internal_key_no, key_no, new_key, old_key); + else + status = nt4h_change_key_pk(auth_key, key_no, new_key, old_key); + if(status) + { + printf("\n變更金鑰失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + printf("\n成功變更金鑰\n"); +} +//------------------------------------------------------------------------------ +void linear_read(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 線性讀取 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t file_no, key_no, comm_mode; + int file_no_int, key_no_int; + char key; + + printf("請輸入檔案編號 (NTAG413 1-2 NTAG424 1-3)\n"); + scanf("%d%*c", &file_no_int); + file_no = file_no_int; + + printf("請輸入金鑰編號 (NTAG413 0-2 NTAG424 0-4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf(" 請選擇通訊模式\n"); + printf(" (1) - 明文模式\n"); + printf(" (2) - MAC 驗證模式\n"); printf(" (3) - 加密模式\n"); + key = _getch(); + if(key == '1') + comm_mode = 0; + else if(key == '2') + comm_mode = 1; + else if(key == '3') + comm_mode = 3; + else + { + printf("選擇錯誤\n"); + return; + } + + status = nt4h_set_global_parameters(file_no, key_no, comm_mode); + if(status) + { + printf("\n設定全域參數失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + uint8_t data[256]; + uint16_t linear_address, length, bytes_returned; + uint8_t aes_key[16]; + int linear_address_int, length_int; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + + printf("請輸入線性位址\n"); + scanf("%d%*c", &linear_address_int); + linear_address = linear_address_int; + + printf("請輸入長度\n"); + scanf("%d%*c", &length_int); + length = length_int; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + printf(" (3) - 無驗證\n"); + key = _getch(); + + if(key == '1') + { + printf("請輸入 AES 金鑰\n"); + if(!enter_aes_key(aes_key)) + return; + + status = LinearRead_PK(data, linear_address, length, &bytes_returned, T4T_PK_PWD_AUTH, aes_key); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = LinearRead(data, linear_address, length, &bytes_returned, T4T_RKA_PWD_AUTH, aes_internal_key_no); + } + else + { + status = LinearRead(data, linear_address, length, &bytes_returned, T4T_WITHOUT_PWD_AUTH, 0); + } + + if(status) + { + printf("\n線性讀取失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + { + printf("\n線性讀取成功\n"); + printf("十六進位: \n"); + print_hex_ln(data, length, ":"); + printf("ASCII 文字:\n"); + printf("%s\n", data); + } +} + +//------------------------------------------------------------------------------ +void linear_write(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 線性寫入 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t file_no, key_no, comm_mode; + int file_no_int, key_no_int; + char key; + + printf("請輸入檔案編號 (NTAG413 1-2 NTAG424 1-3)\n"); + scanf("%d%*c", &file_no_int); + file_no = file_no_int; + + printf("請輸入金鑰編號 (NTAG413 0-2 NTAG424 0-4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf(" 請選擇通訊模式\n"); + printf(" (1) - 明文模式\n"); + printf(" (2) - MAC 驗證模式\n"); + printf(" (3) - 加密模式\n"); + key = _getch(); + if(key == '1') + comm_mode = 0; + else if(key == '2') + comm_mode = 1; + else if(key == '3') + comm_mode = 3; + else + { + printf("選擇錯誤\n"); + return; + } + + status = nt4h_set_global_parameters(file_no, key_no, comm_mode); + if(status) + { + printf("\n設定全域參數失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + uint8_t data[256]; + uint16_t linear_address, length, bytes_returned; + uint8_t aes_key[16]; + int linear_address_int; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + + printf("請輸入線性位址\n"); + scanf("%d%*c", &linear_address_int); + linear_address = linear_address_int; + + printf("請輸入資料\n"); + if(!enter_linear_data(data, &length)) + { + printf("選擇錯誤\n"); + return; + } + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + printf(" (3) - 無驗證\n"); + key = _getch(); + + if(key == '1') + { + printf("請輸入 AES 金鑰\n"); + if(!enter_aes_key(aes_key)) + return; + + status = LinearWrite_PK(data, linear_address, length, &bytes_returned, T4T_PK_PWD_AUTH, aes_key); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = LinearWrite(data, linear_address, length, &bytes_returned, T4T_RKA_PWD_AUTH, aes_internal_key_no); + } + else + { + status = LinearWrite(data, linear_address, length, &bytes_returned, T4T_WITHOUT_PWD_AUTH, 0); + } + + if(status) + { + printf("\n線性寫入失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + { + printf("\n線性寫入成功\n"); + } +} +//------------------------------------------------------------------------------ +void sdm_read(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 安全動態訊息讀取 \n"); + printf(" 檔案編號 = 2, 自由讀取權限, 明文通訊模式 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t file_no, file_type, communication_mode, sdm_enable; + uint8_t read_key_no, write_key_no, read_write_key_no, change_key_no; + uint8_t uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable; + uint8_t meta_data_key_no, file_data_read_key_no, read_ctr_key_no; + uint32_t file_size = 0, uid_offset = 0, read_ctr_offset = 0, picc_data_offset = 0; + uint32_t mac_input_offset = 0, enc_offset = 0, enc_length = 0, mac_offset = 0, read_ctr_limit = 0; + uint8_t data[257]; + uint32_t ret_bytes; + uint8_t picc_data_tag, uid[7]; + uint32_t sdm_read_cnt = 0; + uint8_t file_data_aes_key[16]; + uint8_t tt_status_enable = 0; + uint32_t tt_status_offset = 0; + + uint8_t dl_card_type; + status = GetDlogicCardType(&dl_card_type); + if(status) + { + printf("\n讀取卡片類型失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + file_no = 2; + + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_get_file_settings(file_no, &file_type, &communication_mode, &sdm_enable, &file_size, + &read_key_no, &write_key_no, &read_write_key_no, &change_key_no, + &uid_enable, &read_ctr_enable, &read_ctr_limit_enable, &enc_file_data_enable, + &meta_data_key_no, &file_data_read_key_no, &read_ctr_key_no, + &uid_offset, &read_ctr_offset, &picc_data_offset, + &mac_input_offset, &enc_offset, &enc_length, &mac_offset, &read_ctr_limit, + &tt_status_enable, &tt_status_offset); + else + status = nt4h_get_file_settings(file_no, &file_type, &communication_mode, &sdm_enable, &file_size, + &read_key_no, &write_key_no, &read_write_key_no, &change_key_no, + &uid_enable, &read_ctr_enable, &read_ctr_limit_enable, &enc_file_data_enable, + &meta_data_key_no, &file_data_read_key_no, &read_ctr_key_no, + &uid_offset, &read_ctr_offset, &picc_data_offset, + &mac_input_offset, &enc_offset, &enc_length, &mac_offset, &read_ctr_limit); + if(status) + { + printf("\n讀取檔案設定失敗"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + //check file parameters + if(!(communication_mode == 0 && sdm_enable && read_key_no == 0x0E)) + { + printf("\n檔案非 SDM 模式\n"); + return; + } + + //read file data + memset(data, 0, 257); + + //Read file via APDU commands + status = SetISO14443_4_Mode(); + if(status) + { + printf("\n設定 ISO14443-4 模式失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + //Select NDEF file + uint8_t r_apdu[266]; + uint32_t r_apdu_len; + uint8_t select_apdu[] = {0x00, 0xA4, 0x04, 0x0C, 0x07, 0xD2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01, 0x00}; + + status = APDUPlainTransceive(select_apdu, 13, r_apdu, &r_apdu_len); + if(status) + { + s_block_deselect(100); + printf("\nAPDUPlainTransceive 失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + if(r_apdu[0] != 0x90 && r_apdu[1] != 0x00) + { + s_block_deselect(100); + printf("\nNDEF 檔案選擇失敗\n"); + printf("錯誤碼 = 0x%08X %0x08X\n", r_apdu[0], r_apdu[1]); + return; + } + + //Read NDEF file + uint8_t read_apdu[] = {0x90, 0xAD, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + + status = APDUPlainTransceive(read_apdu, 13, r_apdu, &r_apdu_len); + if(status) + { + s_block_deselect(100); + printf("\nAPDUPlainTransceive 失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + if(r_apdu_len == 2) + { + s_block_deselect(100); + printf("\nNDEF 檔案讀取失敗\n"); + printf("錯誤碼 = 0x%08X %0x08X\n", r_apdu[0], r_apdu[1]); + return; + } + + s_block_deselect(100); + + + memcpy(data, r_apdu, r_apdu_len - 2); + + printf("原始十六進位資料: \n"); + print_hex_ln(data, file_size, ":"); + printf("NDEF 檔案內容: %s\n", &data[7]); + if(meta_data_key_no <= 4) + { + //PICC encrypted data + uint8_t enc_picc_data[33]; + uint8_t picc_data[16]; + uint8_t meta_data_aes_key[16]; + + enc_picc_data[32] = 0; + memcpy(enc_picc_data, &data[picc_data_offset], 32); + printf("\nPICC 加密資料: %s\n", enc_picc_data); + hex2bin(picc_data, (const char *)enc_picc_data); + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰 (此功能目前僅支援提供金鑰)\n"); + printf(" (3) - 從檔案讀取金鑰\n"); + char auth_mode = _getch(); + if(auth_mode == '1') + { + printf("請輸入元資料 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(meta_data_aes_key)) + return; + } + else if(auth_mode == '2') + { + printf("抱歉,SDM 解密功能目前僅支援提供金鑰模式。\n"); + printf("請選擇 (1) 提供金鑰 或 (3) 從檔案讀取金鑰 或按任意鍵返回主選單。\n"); + char retry = _getch(); + if(retry == '1') + { + printf("請輸入元資料 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(meta_data_aes_key)) + return; + } + else if(retry == '3') + { + if(!read_aes_key_from_file(meta_data_aes_key)) + return; + } + else + { + return; + } + } + else if(auth_mode == '3') + { + if(!read_aes_key_from_file(meta_data_aes_key)) + return; + } + else + { + printf("選擇錯誤\n"); + return; + } + + status = nt4h_decrypt_picc_data(picc_data, meta_data_aes_key, &picc_data_tag, uid, &sdm_read_cnt); + if(status) + { + printf("\nPICC 資料解密失敗"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("PICC 資料解密成功\n"); + if(picc_data_tag & 0x80) + { + printf("UID = "); + print_hex_ln(uid, 7, ":"); + } + if(picc_data_tag & 0x40) + { + printf("讀取計數器 = %d\n", sdm_read_cnt); + } + } + if(meta_data_key_no == 0x0E) + { + //PICC data doesn't encrypted + uint8_t ascii_uid[15]; + uint8_t ascii_sdm_read_cnt[7]; + uint8_t sdm_read_cnt_array[3]; + uint8_t temp; + + if(uid_enable) + { + ascii_uid[14] = 0; + memcpy(ascii_uid, &data[uid_offset], 14); + printf("\nUID: %s\n", ascii_uid); + hex2bin(uid, (const char *)ascii_uid); + } + + if(read_ctr_enable) + { + ascii_sdm_read_cnt[6] = 0; + memcpy(ascii_sdm_read_cnt, &data[read_ctr_offset], 6); + printf("\nSDM 讀取計數器: %s\n", ascii_sdm_read_cnt); + hex2bin(sdm_read_cnt_array, (const char *)ascii_sdm_read_cnt); + temp = sdm_read_cnt_array[2]; + sdm_read_cnt_array[2] = sdm_read_cnt_array[0]; + sdm_read_cnt_array[0] = temp; + memcpy(&sdm_read_cnt, sdm_read_cnt_array, 3); + } + } + + if(enc_file_data_enable) + { + //Part of file data encrypted + uint8_t enc_file_data[256]; + uint8_t file_data[128]; + + memset(enc_file_data, 0, 256); + memset(file_data, 0, 128); + + memcpy(enc_file_data, &data[enc_offset], enc_length); + printf("\n檔案資料加密部分: %s\n", enc_file_data); + hex2bin(file_data, (const char *)enc_file_data); + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰 (此功能目前僅支援提供金鑰)\n"); + printf(" (3) - 從檔案讀取金鑰\n"); + char file_auth_mode = _getch(); + if(file_auth_mode == '1') + { + printf("請輸入檔案資料讀取 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(file_data_aes_key)) + return; + } + else if(file_auth_mode == '2') + { + printf("抱歉,SDM 解密功能目前僅支援提供金鑰模式。\n"); + printf("請選擇 (1) 提供金鑰 或 (3) 從檔案讀取金鑰 或按任意鍵返回主選單。\n"); + char retry = _getch(); + if(retry == '1') + { + printf("請輸入檔案資料讀取 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(file_data_aes_key)) + return; + } + else if(retry == '3') + { + if(!read_aes_key_from_file(file_data_aes_key)) + return; + } + else + { + return; + } + } + else if(file_auth_mode == '3') + { + if(!read_aes_key_from_file(file_data_aes_key)) + return; + } + else + { + printf("選擇錯誤\n"); + return; + } + + status = nt4h_decrypt_sdm_enc_file_data(sdm_read_cnt, uid, file_data_aes_key, file_data, enc_length / 2); + if(status) + { + printf("\n檔案資料部分解密失敗"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("檔案資料部分解密成功\n"); + printf("檔案資料部分 = %s\n", file_data); + + if(dl_card_type == DL_NTAG_424_DNA_TT) + { + if(tt_status_enable) + { + uint8_t i; + for(i = 0; i < enc_length / 2; i++) + { + if(file_data[i] == 0) + break; + } + printf("\n防竄改永久狀態: %c\n", file_data[i - 2]); + printf("防竄改目前狀態: %c\n", file_data[i - 1]); + } + } + } + else + { + if(dl_card_type == DL_NTAG_424_DNA_TT) + { + if(tt_status_enable) + { + printf("\n防竄改永久狀態: %c\n", data[tt_status_offset]); + printf("防竄改目前狀態: %c\n", data[tt_status_offset + 1]); + } + } + } + + if(file_data_read_key_no <= 4) + { + //MAC exist + uint8_t ascii_mac_data[17]; + uint8_t mac[8]; + uint8_t ascii_mac_in[256]; + uint8_t mac_in_len; + + if(!enc_file_data_enable) + { + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰 (此功能目前僅支援提供金鑰)\n"); + printf(" (3) - 從檔案讀取金鑰\n"); + char mac_auth_mode = _getch(); + + if(mac_auth_mode == '1') + { + printf("請輸入檔案資料讀取 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(file_data_aes_key)) + return; + } + else if(mac_auth_mode == '2') + { + printf("抱歉,SDM 解密功能目前僅支援提供金鑰模式。\n"); + printf("請選擇 (1) 提供金鑰 或按任意鍵返回主選單。\n"); + char retry = _getch(); + if(retry == '1') + { + printf("請輸入檔案資料讀取 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(file_data_aes_key)) + return; + } + else + { + return; + } + } + else if(mac_auth_mode == '3') + { + if(!read_aes_key_from_file(file_data_aes_key)) + return; + } + else + { + printf("選擇錯誤\n"); + return; + } + } + + ascii_mac_data[16] = 0; + memcpy(ascii_mac_data, &data[mac_offset], 16); + printf("\nASCII MAC 資料: %s\n", ascii_mac_data); + hex2bin(mac, (const char *)ascii_mac_data); + + mac_in_len = mac_offset - mac_input_offset; + printf("[DEBUG] mac_offset=%d, mac_input_offset=%d, mac_in_len=%d\n", + mac_offset, mac_input_offset, mac_in_len); + if(mac_in_len) + { + memcpy(ascii_mac_in, &data[mac_input_offset], mac_in_len); + printf("ASCII MAC 輸入資料: %s\n", ascii_mac_in); + printf("ASCII MAC 輸入資料(HEX): "); + for (int i = 0; i < mac_in_len; i++) printf("%02X", ascii_mac_in[i]); + printf("\n"); + } + + status = nt4h_check_sdm_mac(sdm_read_cnt, uid, file_data_aes_key, ascii_mac_in, mac_in_len, mac); + if(status) + { + printf("\nMAC 不正確\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("MAC 正確\n"); + } + +} +//------------------------------------------------------------------------------ + +void sdm_write(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" Secure dynamic message write \n"); + printf(" File num = 2, free read access, plain communication mode \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t aes_key_ext[16]; + uint8_t file_no, key_no, communication_mode; + uint8_t read_key_no, write_key_no, read_write_key_no, change_key_no; + uint8_t internal_key, aes_internal_key_no; + int key_no_int; + int write_key_no_int, read_write_key_no_int, change_key_no_int; + int aes_internal_key_no_int; + uint8_t uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable; + uint8_t meta_data_key_no, file_data_read_key_no, read_ctr_key_no; + uint32_t uid_offset = 0, read_ctr_offset = 0, picc_data_offset = 0; + uint32_t mac_input_offset = 0, enc_offset = 0, enc_length = 0, mac_offset = 0, read_ctr_limit = 0; + int read_ctr_limit_int, meta_data_key_no_int, file_data_read_key_no_int, read_ctr_key_no_int; + char key; + uint8_t tt_status_enable = 0, tt_status_crypted; + uint32_t tt_status_offset = 0; + + uint8_t dl_card_type; + status = GetDlogicCardType(&dl_card_type); + if(status) + { + printf("\nGet card type failed\n"); + printf("Status = 0x%08X\n", status); + return; + } + + file_no = 2; //NDEF file + communication_mode = 0; //plain + read_key_no = 0x0E; //free read access + + //file access key numbers + printf("\n請輸入變更金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf("\n請輸入寫入金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4) 或 14 或 15\n"); + scanf("%d%*c", &write_key_no_int); + write_key_no = write_key_no_int; + + printf("\n請輸入讀寫金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4) 或 0x14 或 0x15\n"); + scanf("%d%*c", &read_write_key_no_int); + read_write_key_no = read_write_key_no_int; + + printf("\n請輸入新的變更金鑰編號 (NTAG413 為 0-2) (NTAG424 與 NTAG424_TT 為 0-4)\n"); + scanf("%d%*c", &change_key_no_int); + change_key_no = change_key_no_int; + + printf("Is there PICC data (UID, SDM read counter)? (Y/N)\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + { + printf("NTAG424 and NTAG424_TT\n"); + printf("Is PICC data encrypted? (Y/N)\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + { + //encrypted PICC data + printf("請輸入 SDM 元資料讀取權限 (0 - 4)\n"); + scanf("%d%*c", &meta_data_key_no_int); + meta_data_key_no = meta_data_key_no_int; + } + else + { + meta_data_key_no = 0x0E; //plain PICC data + } + + printf("Enable UID mirroring (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + uid_enable = 1; + else + uid_enable = 0; + + printf("Enable read counter mirroring (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + read_ctr_enable = 1; + else + read_ctr_enable = 0; + } + else + { + meta_data_key_no = 0x0F; //no PICC data + } + + printf("Enable part of file data encryption (NTAG424 and NTAG424_TT only) (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + enc_file_data_enable = 1; + else + enc_file_data_enable = 0; + + printf("是否包含 MAC?(Y/N)\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + { + printf("請輸入 SDM 檔案資料讀取權限\n"); + printf("NTAG413: 0-2 MAC 存在\n"); + printf("NTAG424 和 NTAG424_TT: 0-4 MAC 存在\n"); + scanf("%d%*c", &file_data_read_key_no_int); + file_data_read_key_no = file_data_read_key_no_int; + } + else + { + file_data_read_key_no = 0x0F; //no MAC + } + + printf("Enable SDM read counter limit (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + { + read_ctr_limit_enable = 1; + + printf("請輸入 SDM 讀取計數器上限\n"); + scanf("%d%*c", &read_ctr_limit_int); + read_ctr_limit = read_ctr_limit_int; + } + else + read_ctr_limit_enable = 0; + + printf("請輸入 SDM 讀取計數器存取權限\n"); + printf("NTAG413: 0-2 需驗證, 14 - 自由存取, 15 - 禁止存取\n"); + printf("NTAG424/NTAG424_TT: 0-4 需驗證, 14 - 自由存取, 15 - 禁止存取\n"); + scanf("%d%*c", &read_ctr_key_no_int); + read_ctr_key_no = read_ctr_key_no_int; + + //NDEF message creation + uint8_t url[512]; // 增加緩衝區大小支援長 URL + uint8_t url_len; + uint8_t ndef_data[256]; + uint8_t ndef_len; +#define NDEF_HEADER_LEN 7 + uint8_t ndef_header[] = {0x00, 0x00, 0xD1, 0x01, 0x00, 0x55, 0x00}; + + memset(ndef_data, 0, 256); + + printf("請輸入 URL (例如: https://example.com/nfc): "); + enter_ascii_data(url, &url_len); + + // 詢問驗證模式 + char auth_mode; + printf("\n請選擇驗證模式:\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + auth_mode = _getch(); + + uint8_t auth_key_ext[16]; + uint8_t auth_internal_key_no = 0; + + if(auth_mode == '1') + { + printf("\n請輸入 AES 金鑰 (16 位元組十六進位): "); + if(!enter_aes_key(auth_key_ext)) + { + printf("金鑰輸入錯誤\n"); + return; + } + } + else if(auth_mode == '2') + { + printf("\n請輸入 AES 內部金鑰序號 (0 - 15): "); + int tmp_auth_key_no; + scanf("%d%*c", &tmp_auth_key_no); + auth_internal_key_no = (uint8_t)tmp_auth_key_no; + } + else + { + printf("選擇錯誤\n"); + return; + } + + // 建立 NDEF 資料 + memset(ndef_data, 0, 256); + memcpy(&ndef_data[7], url, url_len); + ndef_data[url_len + 7] = '?'; + url_len++; + + // 加入 UID 參數 + ndef_data[url_len + 7] = 'u'; + ndef_data[url_len + 8] = 'i'; + ndef_data[url_len + 9] = 'd'; + ndef_data[url_len + 10] = '='; + memset(&ndef_data[url_len + 11], '0', 14); + uid_offset = url_len + 11; + url_len += 18; + + // 加入讀取計數器參數 + ndef_data[url_len + 7] = '&'; + url_len++; + ndef_data[url_len + 7] = 'c'; + ndef_data[url_len + 8] = 't'; + ndef_data[url_len + 9] = 'r'; + ndef_data[url_len + 10] = '='; + memset(&ndef_data[url_len + 11], '0', 6); + read_ctr_offset = url_len + 11; + url_len += 10; + + // 加入 CMAC 參數 + ndef_data[url_len + 7] = '&'; + url_len++; + ndef_data[url_len + 7] = 'c'; + ndef_data[url_len + 8] = 'm'; + ndef_data[url_len + 9] = 'a'; + ndef_data[url_len + 10] = 'c'; + ndef_data[url_len + 11] = '='; + memset(&ndef_data[url_len + 12], '0', 16); + mac_input_offset = url_len + 12; + mac_offset = url_len + 12; + url_len += 21; + + // 設定 NDEF 標頭 + ndef_header[1] = url_len + 5; + ndef_header[4] = url_len + 1; + memcpy(ndef_data, ndef_header, 7); + + printf("\n正在設定 SDM 功能...\n"); + + // 設定檔案設定 + if(auth_mode == '1') + { + // 使用外部金鑰 + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_change_sdm_file_settings_pk(auth_key_ext, file_no, change_key_no, 3, + communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit, + tt_status_enable, tt_status_offset); + else + status = nt4h_change_sdm_file_settings_pk(auth_key_ext, file_no, change_key_no, 3, + communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit); + } + else + { + // 使用內部金鑰 + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_change_sdm_file_settings(auth_internal_key_no, file_no, change_key_no, 3, + communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit, + tt_status_enable, tt_status_offset); + else + status = nt4h_change_sdm_file_settings(auth_internal_key_no, file_no, change_key_no, 3, + communication_mode, read_key_no, write_key_no, read_write_key_no, change_key_no, + uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable, + meta_data_key_no, file_data_read_key_no, read_ctr_key_no, + uid_offset, read_ctr_offset, picc_data_offset, + mac_input_offset, enc_offset, enc_length, mac_offset, read_ctr_limit); + } + + if(status) + { + printf("\n設定檔案設定失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + // 設定全域參數 + status = nt4h_set_global_parameters(file_no, write_key_no, communication_mode); + if(status) + { + printf("\n設定全域參數失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + // 寫入 NDEF 資料 + uint16_t bytes_written; + status = LinearWrite(ndef_data, 0, url_len + 8, &bytes_written, T4T_WITHOUT_PWD_AUTH, 0); + if(status) + { + printf("\n寫入 NDEF 資料失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("\n✅ 快速 SDM 設定完成!\n"); + printf("URL: %s\n", &ndef_data[7]); + printf("包含: UID 鏡像、讀取計數器、CMAC 驗證\n"); + printf("手機 NFC 讀取時會自動填入真實的 UID、CTR、CMAC\n"); +} +//------------------------------------------------------------------------------ +void read_sdm_counter(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 讀取 SDM 計數器 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t auth_key[16]; + uint8_t file_no, key_no; + uint32_t sdm_read_ctr; + int file_no_int, key_no_int; + char key; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + + printf("請輸入檔案編號 (1 - 3)\n"); + scanf("%d%*c", &file_no_int); + file_no = file_no_int; + + printf("請輸入金鑰編號 (0 - 4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + printf(" (3) - 無驗證\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(auth_key)) + return; + + status = nt4h_get_sdm_ctr_pk(auth_key, file_no, key_no, &sdm_read_ctr); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = nt4h_get_sdm_ctr(aes_internal_key_no, file_no, key_no, &sdm_read_ctr); + } + else + { + status = nt4h_get_sdm_ctr(0, file_no, 0x0E, &sdm_read_ctr); + } + + if(status) + { + printf("\n讀取 SDM 計數器失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("\n成功讀取 SDM 計數器\n"); + printf("SDM 計數器 = %d\n", sdm_read_ctr); +} + +//------------------------------------------------------------------------------ +void store_key(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 將 AES 金鑰存入讀卡機 \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t aes_key[16]; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + + printf("請輸入 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(aes_key)) + return; + + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = uFR_int_DesfireWriteAesKey(aes_internal_key_no, aes_key); + if(status) + { + printf("\n將金鑰存入讀卡機失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + printf("\n成功將金鑰存入讀卡機\n"); +} +//------------------------------------------------------------------------------ +void tt_status_enable(void) +{ +/* + printf(" -------------------------------------------------------------------\n"); + printf(" 啟用防竄改功能 (僅限 NTAG424_TT) \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t aes_key_ext[16]; + char key; + uint8_t key_no; + int key_no_int; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + uint8_t tt_permanent_lock; + + printf("請輸入金鑰編號 (0 - 4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf("永久鎖定防竄改功能 (Y/N)?\n"); + key = _getch(); + if(key == 'Y' || key == 'y') + tt_permanent_lock = 1; + else + tt_permanent_lock = 0; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(aes_key_ext)) + return; + + status = nt4h_tt_set_tag_tamper_pk(aes_key_ext, key_no, tt_permanent_lock); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = nt4h_tt_set_tag_tamper(aes_internal_key_no, key_no, tt_permanent_lock); + } + else + { + printf("選擇錯誤\n"); + return; + } + + if(status) + { + printf("\n啟用防竄改功能失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + printf("\n成功啟用防竄改功能\n"); +*/ +} +//------------------------------------------------------------------------------ +void get_tt_status(void) +{ +/* + printf(" -------------------------------------------------------------------\n"); + printf(" 讀取防竄改狀態 (僅限 NTAG424_TT) \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t aes_key_ext[16]; + char key; + uint8_t key_no; + int key_no_int; + uint8_t aes_internal_key_no; + int aes_internal_key_no_int; + uint8_t tt_status[5]; + + printf("請輸入金鑰編號 (0 - 4)\n"); + scanf("%d%*c", &key_no_int); + key_no = key_no_int; + + printf(" 請選擇驗證模式\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 內部金鑰\n"); + key = _getch(); + if(key == '1') + { + printf("請輸入 AES 金鑰 (16 位元組十六進位)\n"); + if(!enter_aes_key(aes_key_ext)) + return; + + status = nt4h_tt_get_tag_tamper_status_pk(aes_key_ext, key_no, tt_status); + } + else if(key == '2') + { + printf("請輸入 AES 內部金鑰序號 (0 - 15)\n"); + scanf("%d%*c", &aes_internal_key_no_int); + aes_internal_key_no = aes_internal_key_no_int; + + status = nt4h_tt_get_tag_tamper_status(aes_internal_key_no, key_no, tt_status); + } + else + { + printf("選擇錯誤\n"); + return; + } + + if(status) + { + printf("\n讀取防竄改狀態失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + { + printf("\n成功讀取防竄改狀態\n"); + printf("防竄改狀態 = "); + print_hex_ln(tt_status, 5, ":"); + } +*/ +} +//------------------------------------------------------------------------------ +void check_signature(void) +{ +/* + printf(" -------------------------------------------------------------------\n"); + printf(" 檢查 ECC 簽章 (僅限 NTAG424 與 NTAG424_TT) \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t ecc_signature[56]; + + status = nt4h_get_ecc_signature(ecc_signature); + if(status) + { + printf("\n讀取 ECC 簽章失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + } + else + { + printf("\n成功讀取 ECC 簽章\n"); + printf("ECC 簽章 = "); + print_hex_ln(ecc_signature, 56, ":"); + } +*/ +} +//------------------------------------------------------------------------------ +void quick_sdm_setup(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 快速 SDM 設定 (生產用) \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t q_dl_card_type; + uint8_t q_url[512]; // 增加緩衝區大小支援長 URL + uint8_t q_url_len; + uint8_t q_ndef_data[256]; + uint8_t q_ndef_header[] = {0x00, 0x00, 0xD1, 0x01, 0x00, 0x55, 0x00}; + uint16_t q_bytes_written; + + // 檢查卡片類型 + status = GetDlogicCardType(&q_dl_card_type); + if(status) + { + printf("\n讀取卡片類型失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + // 快速設定參數 + uint8_t q_file_no = 2; // NDEF 檔案 + uint8_t q_communication_mode = 0; // 明文模式 + uint8_t q_read_key_no = 0x0E; // 自由讀取 + uint8_t q_write_key_no = 0x0E; // 自由寫入 + uint8_t q_read_write_key_no = 0x0E; // 自由讀寫 + uint8_t q_change_key_no = 0x00; // 變更金鑰 0x00 + uint8_t q_new_change_key_no = 0; // 新變更金鑰 0 + + // SDM 參數 + uint8_t q_uid_enable = 1; // 啟用 UID 鏡像 + uint8_t q_read_ctr_enable = 1; // 啟用讀取計數器 + uint8_t q_read_ctr_limit_enable = 0; // 不啟用計數器限制 + uint8_t q_enc_file_data_enable = 0; // 不啟用檔案加密 + uint8_t q_meta_data_key_no = 0x0E; // 明文 PICC 資料 + uint8_t q_file_data_read_key_no = 0x00; // SDM 檔案金鑰 0x00 + uint8_t q_read_ctr_key_no = 0x0E; // 自由存取計數器 + uint32_t q_read_ctr_limit = 0; + + // 偏移量 + uint32_t q_uid_offset = 44, q_read_ctr_offset = 63, q_picc_data_offset = 0; + uint32_t q_mac_input_offset = 44, q_enc_offset = 0, q_enc_length = 0, q_mac_offset = 74; + uint8_t q_tt_status_enable = 0, q_tt_status_offset = 0; + + printf("請選擇 URL 輸入方式:\n"); + printf(" (1) - 手動輸入 URL\n"); + printf(" (2) - 從檔案讀取 URL\n"); + char url_input_mode = _getch(); + + if(url_input_mode == '1') + { + printf("請輸入 URL (例如: https://example.com/nfc): "); + enter_ascii_data(q_url, &q_url_len); + } + else if(url_input_mode == '2') + { + if(!read_url_from_file(q_url, &q_url_len)) + { + printf("從檔案讀取 URL 失敗\n"); + return; + } + } + else + { + printf("選擇錯誤\n"); + return; + } + + // 詢問驗證模式 + char q_auth_key; + printf("\n請選擇驗證模式:\n"); + printf(" (1) - 提供金鑰\n"); + printf(" (2) - 從檔案讀取金鑰\n"); + q_auth_key = _getch(); + + uint8_t q_aes_key_ext[16]; + if(q_auth_key == '1') + { + printf("\n請輸入 AES 金鑰 (16 位元組十六進位): "); + if(!enter_aes_key(q_aes_key_ext)) + { + printf("金鑰輸入錯誤\n"); + return; + } + } + else if(q_auth_key == '2') + { + if(!read_aes_key_from_file(q_aes_key_ext)) + { + printf("從檔案讀取金鑰失敗\n"); + return; + } + } + else + { + printf("選擇錯誤\n"); + return; + } + + // 建立 NDEF 資料 + memset(q_ndef_data, 0, 256); + + // 先設定 NDEF 標頭 + q_ndef_data[0] = 0x00; // NDEF 開始標記 + q_ndef_data[1] = 0x00; // 長度 (稍後設定) + q_ndef_data[2] = 0xD1; // NDEF 記錄標頭 + q_ndef_data[3] = 0x01; // 類型長度 + q_ndef_data[4] = 0x00; // 載荷長度 (稍後設定) + q_ndef_data[5] = 0x55; // 類型: 'U' (URL) + q_ndef_data[6] = 0x00; // URL 前綴 + + // 複製 URL + memcpy(&q_ndef_data[7], q_url, q_url_len); + + // 檢查 URL 是否已經包含參數,決定使用 ? 還是 & + if (url_has_parameters(q_url, q_url_len)) { + q_ndef_data[q_url_len + 7] = '&'; + } else { + q_ndef_data[q_url_len + 7] = '?'; + } + q_url_len++; + + // 加入 UID 參數 + q_ndef_data[q_url_len + 7] = 'u'; + q_ndef_data[q_url_len + 8] = 'i'; + q_ndef_data[q_url_len + 9] = 'd'; + q_ndef_data[q_url_len + 10] = '='; + memset(&q_ndef_data[q_url_len + 11], '0', 14); + q_uid_offset = q_url_len + 11; + q_url_len += 18; + + // 加入讀取計數器參數 + q_ndef_data[q_url_len + 7] = '&'; + q_url_len++; + q_ndef_data[q_url_len + 7] = 'c'; + q_ndef_data[q_url_len + 8] = 't'; + q_ndef_data[q_url_len + 9] = 'r'; + q_ndef_data[q_url_len + 10] = '='; + memset(&q_ndef_data[q_url_len + 11], '0', 6); + q_read_ctr_offset = q_url_len + 11; + q_url_len += 10; + + // 加入 CMAC 參數 + q_ndef_data[q_url_len + 7] = '&'; + q_url_len++; + q_ndef_data[q_url_len + 7] = 'c'; + q_ndef_data[q_url_len + 8] = 'm'; + q_ndef_data[q_url_len + 9] = 'a'; + q_ndef_data[q_url_len + 10] = 'c'; + q_ndef_data[q_url_len + 11] = '='; + memset(&q_ndef_data[q_url_len + 12], '0', 16); + q_mac_input_offset = q_url_len + 12; + q_mac_offset = q_url_len + 12; + q_url_len += 21; + + // 更新 NDEF 標頭長度 + q_ndef_data[1] = q_url_len + 5; // NDEF 長度 + q_ndef_data[4] = q_url_len + 1; // 載荷長度 + + printf("\n正在設定 SDM 功能...\n"); + + // 設定檔案設定 - 統一使用外部金鑰函數以確保 NDEF 資料不被加密 + if(q_dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_change_sdm_file_settings_pk(q_aes_key_ext, q_file_no, q_change_key_no, 3, + q_communication_mode, q_read_key_no, q_write_key_no, q_read_write_key_no, q_change_key_no, + q_uid_enable, q_read_ctr_enable, q_read_ctr_limit_enable, q_enc_file_data_enable, + q_meta_data_key_no, q_file_data_read_key_no, q_read_ctr_key_no, + q_uid_offset, q_read_ctr_offset, q_picc_data_offset, + q_mac_input_offset, q_enc_offset, q_enc_length, q_mac_offset, q_read_ctr_limit, + q_tt_status_enable, q_tt_status_offset); + else + status = nt4h_change_sdm_file_settings_pk(q_aes_key_ext, q_file_no, q_change_key_no, 3, + q_communication_mode, q_read_key_no, q_write_key_no, q_read_write_key_no, q_change_key_no, + q_uid_enable, q_read_ctr_enable, q_read_ctr_limit_enable, q_enc_file_data_enable, + q_meta_data_key_no, q_file_data_read_key_no, q_read_ctr_key_no, + q_uid_offset, q_read_ctr_offset, q_picc_data_offset, + q_mac_input_offset, q_enc_offset, q_enc_length, q_mac_offset, q_read_ctr_limit); + + if(status) + { + printf("\n設定檔案設定失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + // 設定全域參數 + status = nt4h_set_global_parameters(q_file_no, q_write_key_no, q_communication_mode); + if(status) { + printf("設定全域參數失敗: 0x%08X\n", status); + ReaderClose(); + return; + } + + // 寫入 NDEF 資料 + status = LinearWrite(q_ndef_data, 0, q_url_len + 8, &q_bytes_written, T4T_WITHOUT_PWD_AUTH, 0); + if(status) { + printf("寫入 NDEF 資料失敗: 0x%08X\n", status); + ReaderClose(); + return; + } + + printf("✅ 快速 SDM 設定完成!\n"); + printf("URL: %s\n", &q_ndef_data[7]); + printf("包含: UID 鏡像、讀取計數器、CMAC 驗證\n"); + printf("手機 NFC 讀取時會自動填入真實的 UID、CTR、CMAC\n"); + + // Debug 輸出所有參數 + printf("\n[DEBUG] 參數設定如下:\n"); + printf(" 卡片型號: %d\n", q_dl_card_type); + printf(" 檔案號 (file_no): %d\n", q_file_no); + printf(" 通訊模式 (communication_mode): %d\n", q_communication_mode); + printf(" 變更金鑰編號 (change_key_no): %d\n", q_change_key_no); + printf(" 新變更金鑰編號 (new_change_key_no): %d\n", q_new_change_key_no); + printf(" 寫入金鑰編號 (write_key_no): %d\n", q_write_key_no); + printf(" 讀寫金鑰編號 (read_write_key_no): %d\n", q_read_write_key_no); + printf(" 讀取金鑰編號 (read_key_no): %d\n", q_read_key_no); + printf(" 啟用 UID 鏡像 (uid_enable): %d\n", q_uid_enable); + printf(" 啟用讀取計數器 (read_ctr_enable): %d\n", q_read_ctr_enable); + printf(" 啟用計數器限制 (read_ctr_limit_enable): %d\n", q_read_ctr_limit_enable); + printf(" SDM 計數器限制值 (read_ctr_limit): %u\n", q_read_ctr_limit); + printf(" 啟用檔案加密 (enc_file_data_enable): %d\n", q_enc_file_data_enable); + printf(" SDM meta data key no: %d\n", q_meta_data_key_no); + printf(" SDM file data read key no: %d\n", q_file_data_read_key_no); + printf(" SDM read counter key no: %d\n", q_read_ctr_key_no); + printf(" UID offset: %u\n", q_uid_offset); + printf(" CTR offset: %u\n", q_read_ctr_offset); + printf(" MAC 位移:%u\n", q_mac_offset); + printf(" 其他位移:picc_data_offset=%u, mac_input_offset=%u, enc_offset=%u, enc_length=%u\n", q_picc_data_offset, q_mac_input_offset, q_enc_offset, q_enc_length); + printf(" TT status enable: %d\n", q_tt_status_enable); + printf(" TT status offset: %d\n", q_tt_status_offset); + printf("\n"); +} +//------------------------------------------------------------------------------ +bool read_aes_key_from_file(uint8_t *aes_key) +{ + char path[256] = "keys.txt"; + char hexstr[100]; + FILE *fp; + size_t str_len; + char *newline; + char *p; + char *lines[32]; // 最多支援 32 組金鑰 + int key_count = 0, i, sel = 0; + + fp = fopen(path, "r"); + if (fp) { + // 先讀所有合法金鑰 + while (fgets(hexstr, sizeof(hexstr), fp) && key_count < 32) { + // 去除換行 + newline = strchr(hexstr, '\n'); + if (newline) *newline = '\0'; + // 跳過註解或空行 + for (p = hexstr; isspace(*p); ++p); + if (*p == '#' || *p == '\0') continue; + // 檢查長度與內容 + int valid = 1; + for (i = 0; i < 32 && p[i]; ++i) { + if (!isxdigit(p[i])) { valid = 0; break; } + } + if (valid && i == 32 && p[32] == '\0') { + lines[key_count] = strdup(p); + key_count++; + } + } + fclose(fp); + if (key_count > 0) { + printf("\n發現 %d 組金鑰於 %s:\n", key_count, path); + for (i = 0; i < key_count; ++i) { + printf(" (%d) %.*s...\n", i+1, 6, lines[i]); + } + printf("請選擇要使用的金鑰編號 (1-%d):\n", key_count); + scanf("%d%*c", &sel); + if (sel < 1 || sel > key_count) { + printf("選擇錯誤\n"); + for (i = 0; i < key_count; ++i) free(lines[i]); + return false; + } + str_len = hex2bin(aes_key, lines[sel-1]); + for (i = 0; i < key_count; ++i) free(lines[i]); + if (str_len != 16) { + printf("金鑰格式錯誤\n"); + return false; + } + printf("已成功從 %s 讀取金鑰!\n", path); + return true; + } + } + // fallback: 手動輸入路徑 + printf("找不到 %s 或檔案無有效金鑰,請手動輸入金鑰檔案路徑:\n", path); + scanf("%255s%*c", path); + fp = fopen(path, "r"); + if (!fp) { + printf("無法開啟檔案:%s\n", path); + return false; + } + if (!fgets(hexstr, sizeof(hexstr), fp)) { + printf("讀取檔案失敗或檔案為空\n"); + fclose(fp); + return false; + } + fclose(fp); + newline = strchr(hexstr, '\n'); + if (newline) *newline = '\0'; + str_len = hex2bin(aes_key, hexstr); + if (str_len != 16) { + printf("金鑰格式錯誤,請確認檔案內容為 32 個十六進位字元\n"); + return false; + } + printf("已成功從檔案讀取金鑰!\n"); + return true; +} +//------------------------------------------------------------------------------ +bool read_url_from_file(uint8_t *url, uint8_t *url_len) +{ + char path[256] = "urls.txt"; + char hexstr[512]; // 增加緩衝區大小以支援長 URL + FILE *fp; + size_t str_len; + char *newline; + char *p; + char *lines[32]; // 最多支援 32 組 URL + int url_count = 0, i, sel = 0; + + fp = fopen(path, "r"); + if (fp) { + // 先讀所有合法 URL + while (fgets(hexstr, sizeof(hexstr), fp) && url_count < 32) { + // 去除換行 + newline = strchr(hexstr, '\n'); + if (newline) *newline = '\0'; + // 跳過註解或空行 + for (p = hexstr; isspace(*p); ++p); + if (*p == '#' || *p == '\0') continue; + // 檢查長度與內容(支援最多 400 字符的 URL) + int valid = 1; + for (i = 0; i < 400 && p[i]; ++i) { + if (!isprint(p[i])) { valid = 0; break; } + } + if (valid && i < 400 && p[i] == '\0') { + lines[url_count] = strdup(p); + url_count++; + } + } + fclose(fp); + if (url_count > 0) { + printf("\n發現 %d 組 URL 於 %s:\n", url_count, path); + for (i = 0; i < url_count; ++i) { + printf(" (%d) %.*s...\n", i+1, 100, lines[i]); + } + printf("請選擇要使用的 URL 編號 (1-%d):\n", url_count); + scanf("%d%*c", &sel); + if (sel < 1 || sel > url_count) { + printf("選擇錯誤\n"); + for (i = 0; i < url_count; ++i) free(lines[i]); + return false; + } + str_len = strlen(lines[sel-1]); + if (str_len > 400) { + printf("URL 格式錯誤(超過 400 字符限制)\n"); + for (i = 0; i < url_count; ++i) free(lines[i]); + return false; + } + printf("已成功從 %s 讀取 URL!\n", path); + strcpy(url, lines[sel-1]); + *url_len = str_len; + for (i = 0; i < url_count; ++i) free(lines[i]); + return true; + } + } + // fallback: 手動輸入路徑 + printf("找不到 %s 或檔案無有效 URL,請手動輸入 URL 檔案路徑:\n", path); + scanf("%255s%*c", path); + fp = fopen(path, "r"); + if (!fp) { + printf("無法開啟檔案:%s\n", path); + return false; + } + if (!fgets(hexstr, sizeof(hexstr), fp)) { + printf("讀取檔案失敗或檔案為空\n"); + fclose(fp); + return false; + } + fclose(fp); + newline = strchr(hexstr, '\n'); + if (newline) *newline = '\0'; + str_len = strlen(hexstr); + if (str_len > 400) { + printf("URL 格式錯誤,請確認檔案內容不超過 400 個 ASCII 字元\n"); + return false; + } + printf("已成功從檔案讀取 URL!\n"); + strcpy(url, hexstr); + *url_len = str_len; + return true; +} +//------------------------------------------------------------------------------ +bool read_aes_key_by_index(uint8_t *aes_key, int index) +{ + char path[256] = "keys.txt"; + char hexstr[100]; + FILE *fp; + char *newline; + char *p; + char *lines[32]; + int key_count = 0, i; + + fp = fopen(path, "r"); + if (!fp) { + printf("無法開啟金鑰檔案: %s\n", path); + return false; + } + + // 讀取所有合法金鑰 + while (fgets(hexstr, sizeof(hexstr), fp) && key_count < 32) { + newline = strchr(hexstr, '\n'); + if (newline) *newline = '\0'; + for (p = hexstr; isspace(*p); ++p); + if (*p == '#' || *p == '\0') continue; + + int valid = 1; + for (i = 0; i < 32 && p[i]; ++i) { + if (!isxdigit(p[i])) { valid = 0; break; } + } + if (valid && i == 32 && p[32] == '\0') { + lines[key_count] = strdup(p); + key_count++; + } + } + fclose(fp); + + if (index < 1 || index > key_count) { + printf("金鑰索引超出範圍 (1-%d)\n", key_count); + for (i = 0; i < key_count; ++i) free(lines[i]); + return false; + } + + size_t str_len = hex2bin(aes_key, lines[index-1]); + + if (str_len != 16) { + printf("金鑰格式錯誤\n"); + for (i = 0; i < key_count; ++i) free(lines[i]); + return false; + } + + printf("已載入金鑰 #%d: %.*s...\n", index, 6, lines[index-1]); + for (i = 0; i < key_count; ++i) free(lines[i]); + return true; +} +//------------------------------------------------------------------------------ +bool read_url_by_index(uint8_t *url, uint8_t *url_len, int index) +{ + char path[256] = "urls.txt"; + char hexstr[512]; // 增加緩衝區大小以支援長 URL + FILE *fp; + char *newline; + char *p; + char *lines[32]; + int url_count = 0, i; + + fp = fopen(path, "r"); + if (!fp) { + printf("無法開啟 URL 檔案: %s\n", path); + return false; + } + + // 讀取所有合法 URL + while (fgets(hexstr, sizeof(hexstr), fp) && url_count < 32) { + newline = strchr(hexstr, '\n'); + if (newline) *newline = '\0'; + for (p = hexstr; isspace(*p); ++p); + if (*p == '#' || *p == '\0') continue; + + int valid = 1; + for (i = 0; i < 400 && p[i]; ++i) { + if (!isprint(p[i])) { valid = 0; break; } + } + if (valid && i < 400 && p[i] == '\0') { + lines[url_count] = strdup(p); + url_count++; + } + } + fclose(fp); + + if (index < 1 || index > url_count) { + printf("URL 索引超出範圍 (1-%d)\n", url_count); + for (i = 0; i < url_count; ++i) free(lines[i]); + return false; + } + + size_t str_len = strlen(lines[index-1]); + if (str_len > 400) { + printf("URL 格式錯誤(超過 400 字符限制)\n"); + for (i = 0; i < url_count; ++i) free(lines[i]); + return false; + } + + strcpy(url, lines[index-1]); + *url_len = str_len; + + printf("已載入 URL #%d: %s\n", index, lines[index-1]); + for (i = 0; i < url_count; ++i) free(lines[i]); + return true; +} +//------------------------------------------------------------------------------ +bool validate_ndef_format(uint8_t *data, bool quiet_mode) +{ + // 驗證 NDEF 記錄格式 + // 預期格式: [長度字節] [長度字節] [0xD1] [0x01] [Payload長度] [0x55] [0x00] [URL內容...] + + // 檢查是否為空白 NDEF 檔案 (新卡片) + if (data[0] == 0x00 && data[1] == 0x00) { + if (!quiet_mode) { + printf("⚠️ 檢測到空白 NDEF 檔案 (可能是新卡片)\n"); + printf(" 建議先使用 setsdm 命令設定 SDM 功能\n"); + } + return false; + } + + // 檢查是否為非 URL NDEF 記錄 + if (data[2] == 0xD1 && data[3] == 0x01 && data[5] != 0x55) { + if (!quiet_mode) { + printf("⚠️ 檢測到非 URL 類型的 NDEF 記錄 (類型: 0x%02X)\n", data[5]); + printf(" 需要 URL 類型 (0x55) 才能進行 SDM 驗證\n"); + } + return false; + } + + // 檢查 NDEF 記錄標頭 (位置 2) + if (data[2] != 0xD1) { + if (!quiet_mode) { + printf("❌ NDEF 記錄標頭錯誤: 預期 0xD1,實際 0x%02X\n", data[2]); + printf(" 這可能不是標準的 NDEF 記錄\n"); + } + return false; + } + + // 檢查類型長度 (位置 3) + if (data[3] != 0x01) { + if (!quiet_mode) { + printf("❌ NDEF 類型長度錯誤: 預期 0x01,實際 0x%02X\n", data[3]); + } + return false; + } + + // 檢查 URL 類型標識符 (位置 5) + if (data[5] != 0x55) { + if (!quiet_mode) { + printf("❌ NDEF 類型錯誤: 預期 URL 類型 0x55,實際 0x%02X\n", data[5]); + } + return false; + } + + // 檢查 URL 前綴 (位置 6,應該是 0x00 表示無前綴) + if (data[6] != 0x00) { + if (!quiet_mode) { + printf("❌ URL 前綴錯誤: 預期 0x00,實際 0x%02X\n", data[6]); + } + return false; + } + + // 檢查總長度與 Payload 長度的一致性 + uint8_t total_length = data[1]; + uint8_t payload_length = data[4]; + + // NDEF 結構: [長度][長度][標頭][類型長度][Payload長度][類型][URL前綴][Payload...] + // 總長度 = 標頭(1) + 類型長度(1) + Payload長度(1) + 類型(1) + URL前綴(1) + Payload = 5 + Payload + // 但實際上總長度是從位置2開始算起的長度 + if (total_length != payload_length + 4) { + if (!quiet_mode) { + printf("❌ NDEF 長度不一致: 總長度 %d,Payload 長度 %d (預期: %d)\n", + total_length, payload_length, payload_length + 4); + } + return false; + } + + if (!quiet_mode) { + printf("✅ NDEF 格式驗證通過\n"); + printf(" - 記錄標頭: 0x%02X (正確)\n", data[2]); + printf(" - 類型長度: %d (正確)\n", data[3]); + printf(" - URL 類型: 0x%02X (正確)\n", data[5]); + printf(" - 總長度: %d,Payload 長度: %d (一致)\n", total_length, payload_length); + } + + return true; +} +//------------------------------------------------------------------------------ +void cli_help(void) +{ + printf("NT4H CLI 工具\n"); + printf("用法: ./nt4h_c_example <命令> [選項]\n\n"); + printf("命令:\n"); + printf(" verify [--key <索引>] - CMAC 驗證現有標籤\n"); + printf(" setsdm [--url <索引>] [--key <索引>] - 快速 SDM 設定\n"); + printf(" getuid [--key <索引>] - 讀取 UID\n"); + printf(" changekey [--auth-key <索引>] [--new-key <索引>] [--old-key <索引>] [--key-no <編號>] - 變更 AES 金鑰\n"); + printf(" writendef --url 或 --url-index <索引> - 寫入單純 NDEF (無 SDM)\n"); + printf(" readndef - 讀取單純 NDEF (無 SDM)\n"); + printf(" help - 顯示此說明\n\n"); + printf("選項:\n"); + printf(" --key <索引> - 使用 keys.txt 中第 <索引> 個金鑰 (1-based)\n"); + printf(" --url <索引> - 使用 urls.txt 中第 <索引> 個 URL (1-based)\n"); + printf(" --url-index <索引> - 手動驗證模式中使用的 URL 索引 (1-based)\n"); + printf(" --auth-key <索引> - 使用 keys.txt 中第 <索引> 個金鑰作為認證金鑰\n"); + printf(" --new-key <索引> - 使用 keys.txt 中第 <索引> 個金鑰作為新金鑰\n"); + printf(" --old-key <索引> - 使用 keys.txt 中第 <索引> 個金鑰作為舊金鑰\n"); + printf(" --key-no <編號> - 指定要變更的金鑰編號 (0-4)\n"); + printf(" --manual - 手動驗證模式\n"); + printf(" --uid - 指定 UID (14位十六進位)\n"); + printf(" --ctr <計數器> - 指定計數器 (6位十六進位)\n"); + printf(" --cmac - 指定 CMAC (16位十六進位)\n"); + printf(" --url <完整NDEF_URL> - 指定完整 NDEF URL,自動解析參數\n"); + printf(" --quiet, -q - 安靜模式,只輸出 SUCCEED 或 FAILED\n\n"); + printf("範例:\n"); + printf(" ./nt4h_c_example verify --key 1\n"); + printf(" ./nt4h_c_example verify --manual --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4\n"); + printf(" ./nt4h_c_example verify --manual --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4 --key 2 --url-index 2\n"); + printf(" ./nt4h_c_example verify --manual --url \"https://nodered.contree.app/nfc?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4\"\n"); + printf(" ./nt4h_c_example verify --manual --quiet --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4\n"); + printf(" ./nt4h_c_example verify --quiet --key 1\n"); + printf(" ./nt4h_c_example setsdm --quiet --url 1 --key 2\n"); + printf(" ./nt4h_c_example getuid --quiet --key 3\n"); + printf(" ./nt4h_c_example changekey --auth-key 1 --new-key 2 --old-key 1 --key-no 1\n"); + printf(" ./nt4h_c_example changekey --quiet --auth-key 1 --new-key 3 --old-key 2 --key-no 0\n"); + printf(" ./nt4h_c_example writendef --url \"https://example.com/my-url\"\n"); + printf(" ./nt4h_c_example writendef --url-index 4\n"); + printf(" ./nt4h_c_example writendef --url \"https://game.digitalent.cc/sheepgame/match?token=abc123\"\n"); + printf(" ./nt4h_c_example readndef\n"); +} +//------------------------------------------------------------------------------ +void cli_verify(int argc, char *argv[]) +{ + int key_index = 1; // 預設使用第1個金鑰 + int url_index = 1; // 預設使用第1個URL + bool manual_mode = false; + bool quiet_mode = false; + char *cmac_value = NULL; + char *ctr_value = NULL; + char *uid_value = NULL; + char *macin_value = NULL; + + // 解析參數 + for (int i = 2; i < argc; i++) { + if (strcmp(argv[i], "--key") == 0 && i + 1 < argc) { + key_index = atoi(argv[i + 1]); + i++; // 跳過下一個參數 + } else if (strcmp(argv[i], "--url-index") == 0 && i + 1 < argc) { + url_index = atoi(argv[i + 1]); + i++; // 跳過下一個參數 + } else if ((strcmp(argv[i], "--manual") == 0 || strcmp(argv[i], "--manal") == 0)) { + manual_mode = true; + } else if (strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "-q") == 0) { + quiet_mode = true; + } else if (strcmp(argv[i], "--cmac") == 0 && i + 1 < argc) { + cmac_value = argv[i + 1]; + i++; + } else if (strcmp(argv[i], "--ctr") == 0 && i + 1 < argc) { + ctr_value = argv[i + 1]; + i++; + } else if (strcmp(argv[i], "--uid") == 0 && i + 1 < argc) { + uid_value = argv[i + 1]; + i++; + } else if (strcmp(argv[i], "--macin") == 0 && i + 1 < argc) { + macin_value = argv[i + 1]; + i++; + } else if (strcmp(argv[i], "--url") == 0 && i + 1 < argc) { + // 新增 --url 參數 + char *url_arg = argv[i + 1]; + // 解析 URL,抓出 uid/ctr/mac + char *uid_ptr = strstr(url_arg, "uid="); + char *ctr_ptr = strstr(url_arg, "ctr="); + char *mac_ptr = strstr(url_arg, "mac="); + if (uid_ptr && ctr_ptr && mac_ptr) { + static char uid_buf[15] = {0}; + static char ctr_buf[7] = {0}; + static char mac_buf[17] = {0}; + strncpy(uid_buf, uid_ptr + 4, 14); + uid_buf[14] = '\0'; + strncpy(ctr_buf, ctr_ptr + 4, 6); + ctr_buf[6] = '\0'; + strncpy(mac_buf, mac_ptr + 4, 16); + mac_buf[16] = '\0'; + uid_value = uid_buf; + ctr_value = ctr_buf; + cmac_value = mac_buf; + // 不設定 macin_value,讓後續邏輯使用 mac_input_len=0 + // 這樣就會和互動模式及手動模式一致 + } + i++; + } else { + // 檢測無效參數 + if (argv[i][0] == '-') { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 錯誤:無效參數 '%s'\n", argv[i]); + printf("使用 'help' 查看正確的參數格式\n"); + printf("常見錯誤:--keys 應該是 --key\n"); + } + return; + } + } + } + + if (!quiet_mode) printf("=== CMAC 驗證模式 ===\n"); + + // 手動驗證模式 + if (manual_mode) { + if (!cmac_value || !ctr_value || !uid_value) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("手動驗證模式需要提供 --cmac、--ctr、--uid 參數\n"); + printf("範例: ./nt4h_c_example verify --manual --cmac AD8971B64978C6AC --ctr 42 --uid 0456735AD51F90\n"); + } + return; + } + + // 讀取金鑰(不需要讀卡機) + uint8_t auth_key[16]; + FILE *old_stdout = NULL; + if (quiet_mode) { + old_stdout = stdout; + stdout = fopen("/dev/null", "w"); + } + bool key_result = read_aes_key_by_index(auth_key, key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout; + } + if (!key_result) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("載入金鑰失敗\n"); + } + return; + } + + if (!quiet_mode) { + printf("=== 手動 CMAC 驗證模式 ===\n"); + printf("CMAC: %s\n", cmac_value); + printf("計數器: %s\n", ctr_value); + printf("UID: %s\n", uid_value); + if (macin_value) printf("MAC 輸入資料(16進位): %s\n", macin_value); + } + + // 解析參數 + uint8_t uid[7]; + uint32_t sdm_read_cnt; + uint8_t mac[8]; + + // 解析 UID + if (strlen(uid_value) != 14) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("UID 格式錯誤,應為 14 位十六進位字元\n"); + } + return; + } + hex2bin(uid, uid_value); + + // 解析計數器 + if (strlen(ctr_value) != 6) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("計數器格式錯誤,應為 6 位十六進位字元\n"); + } + return; + } + uint8_t ctr_array[3]; + hex2bin(ctr_array, ctr_value); + // 轉換計數器格式(小端序) + uint8_t temp = ctr_array[2]; + ctr_array[2] = ctr_array[0]; + ctr_array[0] = temp; + memcpy(&sdm_read_cnt, ctr_array, 3); + + // 解析 MAC + if (strlen(cmac_value) != 16) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("CMAC 格式錯誤,應為 16 位十六進位字元\n"); + } + return; + } + hex2bin(mac, cmac_value); + + // MAC 輸入資料 - 從實際 NDEF URL 結構重建 + uint8_t mac_input_data[256]; + uint8_t mac_input_len = 0; + + // 若有 --macin 則直接使用指定的 HEX 資料 + if (macin_value) { + mac_input_len = strlen(macin_value) / 2; + hex2bin(mac_input_data, macin_value); + } else { + // 重建 URL 字串來取得正確的 MAC 輸入資料 + // 根據互動模式的邏輯,MAC 輸入資料只包含 URL 部分(到 &cmac= 之前) + uint8_t base_url[512]; // 增加緩衝區大小支援長 URL + uint8_t base_url_len; + FILE *old_stdout2 = NULL; + if (quiet_mode) { + old_stdout2 = stdout; + stdout = fopen("/dev/null", "w"); + } + bool url_result = read_url_by_index(base_url, &base_url_len, url_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout2; + } + if (url_result) { + // 組合完整 URL 到 &cmac= 之前 + char url_with_params[600]; // 增加緩衝區大小支援長 URL + snprintf(url_with_params, sizeof(url_with_params), + "%s?uid=%s&ctr=%s", (char*)base_url, uid_value, ctr_value); + + // MAC 輸入資料只取 URL 部分(不包含 NDEF header,不包含 &cmac=) + mac_input_len = strlen(url_with_params); + memcpy(mac_input_data, url_with_params, mac_input_len); + + // 顯示完整的 NDEF URL(包含 CMAC) + if (!quiet_mode) { + char full_ndef_url[700]; // 增加緩衝區大小支援長 URL + snprintf(full_ndef_url, sizeof(full_ndef_url), + "%s&cmac=%s", url_with_params, cmac_value); + printf("完整 NDEF URL: %s\n", full_ndef_url); + } + } else { + if (!quiet_mode) printf("無法讀取基礎 URL,使用預設 URL\n"); + // 使用預設 URL 作為 fallback + char url_with_params[600]; // 增加緩衝區大小支援長 URL + snprintf(url_with_params, sizeof(url_with_params), + "https://nodered.contree.app/nfc?uid=%s&ctr=%s", uid_value, ctr_value); + + // MAC 輸入資料只取 URL 部分(不包含 NDEF header,不包含 &cmac=) + mac_input_len = strlen(url_with_params); + memcpy(mac_input_data, url_with_params, mac_input_len); + + // 顯示完整的 NDEF URL(包含 CMAC) + if (!quiet_mode) { + char full_ndef_url[700]; // 增加緩衝區大小支援長 URL + snprintf(full_ndef_url, sizeof(full_ndef_url), + "%s&cmac=%s", url_with_params, cmac_value); + printf("完整 NDEF URL: %s\n", full_ndef_url); + } + } + } + + if (!quiet_mode) { + printf("MAC 輸入資料長度: %d\n", mac_input_len); + printf("MAC 輸入資料內容(HEX): "); + for (int i = 0; i < mac_input_len; i++) printf("%02X", mac_input_data[i]); + printf("\n"); + } + + // 執行 MAC 驗證 + // 根據互動模式的邏輯,當沒有額外 MAC 輸入資料時使用 mac_in_len=0 + uint8_t *actual_mac_input = (mac_input_len > 0) ? mac_input_data : NULL; + uint8_t actual_mac_input_len = (macin_value) ? mac_input_len : 0; + + if (!quiet_mode) printf("[DEBUG] 使用 mac_input_len=%d\n", actual_mac_input_len); + UFR_STATUS status = nt4h_check_sdm_mac(sdm_read_cnt, uid, auth_key, actual_mac_input, actual_mac_input_len, mac); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("MAC 驗證失敗: 0x%08X\n", status); + printf("請檢查 MAC 輸入資料格式是否正確\n"); + } + return; + } + + if (quiet_mode) { + printf("SUCCEED\n"); + } else { + printf("✅ MAC 驗證成功!\n"); + printf("=== 手動驗證完成 ===\n"); + } + return; + } + + // 原有的自動讀取驗證模式 + // 初始化讀卡機 + UFR_STATUS status = ReaderOpen(); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("開啟讀卡機失敗: 0x%08X\n", status); + } + return; + } + + // 讀取金鑰 + uint8_t auth_key[16]; + FILE *old_stdout_auto = NULL; + if (quiet_mode) { + old_stdout_auto = stdout; + stdout = fopen("/dev/null", "w"); + } + bool key_result_auto = read_aes_key_by_index(auth_key, key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout_auto; + } + if (!key_result_auto) { + if (quiet_mode) { + printf("FAILED\n"); + } + ReaderClose(); + return; + } + + // 執行 SDM 讀取(驗證) + if (!quiet_mode) printf("請將卡片放在讀卡機上...\n"); + uint8_t file_no = 2; + uint8_t file_type, communication_mode, sdm_enable; + uint8_t read_key_no, write_key_no, read_write_key_no, change_key_no; + uint8_t uid_enable, read_ctr_enable, read_ctr_limit_enable, enc_file_data_enable; + uint8_t meta_data_key_no, file_data_read_key_no, read_ctr_key_no; + uint32_t file_size = 0, uid_offset = 0, read_ctr_offset = 0, picc_data_offset = 0; + uint32_t mac_input_offset = 0, enc_offset = 0, enc_length = 0, mac_offset = 0, read_ctr_limit = 0; + uint8_t data[257]; + uint32_t ret_bytes; + uint8_t picc_data_tag, uid[7]; + uint32_t sdm_read_cnt = 0; + uint8_t file_data_aes_key[16]; + uint8_t tt_status_enable = 0; + uint32_t tt_status_offset = 0; + + uint8_t dl_card_type; + status = GetDlogicCardType(&dl_card_type); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取卡片類型失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + // 讀取檔案設定 + if(dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_get_file_settings(file_no, &file_type, &communication_mode, &sdm_enable, &file_size, + &read_key_no, &write_key_no, &read_write_key_no, &change_key_no, + &uid_enable, &read_ctr_enable, &read_ctr_limit_enable, &enc_file_data_enable, + &meta_data_key_no, &file_data_read_key_no, &read_ctr_key_no, + &uid_offset, &read_ctr_offset, &picc_data_offset, + &mac_input_offset, &enc_offset, &enc_length, &mac_offset, &read_ctr_limit, + &tt_status_enable, &tt_status_offset); + else + status = nt4h_get_file_settings(file_no, &file_type, &communication_mode, &sdm_enable, &file_size, + &read_key_no, &write_key_no, &read_write_key_no, &change_key_no, + &uid_enable, &read_ctr_enable, &read_ctr_limit_enable, &enc_file_data_enable, + &meta_data_key_no, &file_data_read_key_no, &read_ctr_key_no, + &uid_offset, &read_ctr_offset, &picc_data_offset, + &mac_input_offset, &enc_offset, &enc_length, &mac_offset, &read_ctr_limit); + + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取檔案設定失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if(!(communication_mode == 0 && sdm_enable && read_key_no == 0x0E)) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("檔案非 SDM 模式\n"); + } + ReaderClose(); + return; + } + + // 讀取檔案資料 + memset(data, 0, 257); + + //Read file via APDU commands(複製自 sdm_read) + status = SetISO14443_4_Mode(); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("設定 ISO14443-4 模式失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + //Select NDEF file + uint8_t r_apdu[266]; + uint32_t r_apdu_len; + uint8_t select_apdu[] = {0x00, 0xA4, 0x04, 0x0C, 0x07, 0xD2, 0x76, 0x00, 0x00, 0x85, 0x01, 0x01, 0x00}; + + status = APDUPlainTransceive(select_apdu, 13, r_apdu, &r_apdu_len); + if(status) { + s_block_deselect(100); + printf("APDUPlainTransceive 失敗: 0x%08X\n", status); + ReaderClose(); + return; + } + + if(r_apdu[0] != 0x90 && r_apdu[1] != 0x00) { + s_block_deselect(100); + printf("NDEF 檔案選擇失敗: 0x%02X %02X\n", r_apdu[0], r_apdu[1]); + ReaderClose(); + return; + } + + //Read NDEF file + uint8_t read_apdu[] = {0x90, 0xAD, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + status = APDUPlainTransceive(read_apdu, 13, r_apdu, &r_apdu_len); + if(status) { + s_block_deselect(100); + printf("APDUPlainTransceive 失敗: 0x%08X\n", status); + ReaderClose(); + return; + } + + if(r_apdu_len == 2) { + s_block_deselect(100); + printf("NDEF 檔案讀取失敗: 0x%02X %02X\n", r_apdu[0], r_apdu[1]); + ReaderClose(); + return; + } + + s_block_deselect(100); + memcpy(data, r_apdu, r_apdu_len - 2); + + // Debug: 印出 data 內容 + if (!quiet_mode) { + printf("[DEBUG] 讀取到的檔案資料 (data):\n"); + for (int i = 0; i < 96; i++) { + printf("%02X ", data[i]); + if ((i + 1) % 16 == 0) printf("\n"); + } + printf("\n"); + } + + // 驗證 NDEF 格式 + if (!validate_ndef_format(data, quiet_mode)) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("NDEF 格式驗證失敗\n"); + } + ReaderClose(); + return; + } + + // 顯示 NDEF 網址內容 + if (!quiet_mode) { + char ndef_url[200] = {0}; + uint8_t payload_len = data[4]; + if (payload_len > 1 && payload_len < sizeof(ndef_url)) { + memcpy(ndef_url, &data[7], payload_len - 1); // -1 去掉 0x00 前綴 + ndef_url[payload_len - 1] = '\0'; + printf("讀取到的 NDEF 網址: %s\n", ndef_url); + } + } + + // 處理 PICC 資料 + if(meta_data_key_no <= 4) { + // 加密 PICC 資料 + uint8_t enc_picc_data[33]; + uint8_t picc_data[16]; + uint8_t meta_data_aes_key[16]; + + enc_picc_data[32] = 0; + memcpy(enc_picc_data, &data[picc_data_offset], 32); + if (!quiet_mode) printf("PICC 加密資料: %s\n", enc_picc_data); + hex2bin(picc_data, (const char *)enc_picc_data); + + // 使用提供的金鑰解密 + memcpy(meta_data_aes_key, auth_key, 16); + status = nt4h_decrypt_picc_data(picc_data, meta_data_aes_key, &picc_data_tag, uid, &sdm_read_cnt); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("PICC 資料解密失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (!quiet_mode) { + printf("PICC 資料解密成功\n"); + if(picc_data_tag & 0x80) { + printf("UID = "); + print_hex_ln(uid, 7, ":"); + } + if(picc_data_tag & 0x40) { + printf("讀取計數器 = %d\n", sdm_read_cnt); + } + } + } else if(meta_data_key_no == 0x0E) { + // 明文 PICC 資料 + uint8_t ascii_uid[15]; + uint8_t ascii_sdm_read_cnt[7]; + uint8_t sdm_read_cnt_array[3]; + uint8_t temp; + + if(uid_enable) { + ascii_uid[14] = 0; + memcpy(ascii_uid, &data[uid_offset], 14); + if (!quiet_mode) printf("UID: %s\n", ascii_uid); + hex2bin(uid, (const char *)ascii_uid); + } + + if(read_ctr_enable) { + ascii_sdm_read_cnt[6] = 0; + memcpy(ascii_sdm_read_cnt, &data[read_ctr_offset], 6); + if (!quiet_mode) printf("SDM 讀取計數器: %s\n", ascii_sdm_read_cnt); + hex2bin(sdm_read_cnt_array, (const char *)ascii_sdm_read_cnt); + temp = sdm_read_cnt_array[2]; + sdm_read_cnt_array[2] = sdm_read_cnt_array[0]; + sdm_read_cnt_array[0] = temp; + memcpy(&sdm_read_cnt, sdm_read_cnt_array, 3); + } + } + + // 處理 MAC 驗證 + if(file_data_read_key_no <= 4) { + uint8_t ascii_mac_data[17]; + uint8_t mac[8]; + uint8_t ascii_mac_in[256]; + uint8_t mac_in_len; + + if(!enc_file_data_enable) { + memcpy(file_data_aes_key, auth_key, 16); + } + + ascii_mac_data[16] = 0; + memcpy(ascii_mac_data, &data[mac_offset], 16); + if (!quiet_mode) printf("ASCII MAC 資料: %s\n", ascii_mac_data); + hex2bin(mac, (const char *)ascii_mac_data); + + mac_in_len = mac_offset - mac_input_offset; + if(mac_in_len) { + memcpy(ascii_mac_in, &data[mac_input_offset], mac_in_len); + if (!quiet_mode) { + printf("ASCII MAC 輸入資料: %s\n", ascii_mac_in); + printf("ASCII MAC 輸入資料(HEX): "); + for (int i = 0; i < mac_in_len; i++) printf("%02X", ascii_mac_in[i]); + printf("\n"); + } + } + + status = nt4h_check_sdm_mac(sdm_read_cnt, uid, file_data_aes_key, ascii_mac_in, mac_in_len, mac); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("MAC 驗證失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (quiet_mode) { + printf("SUCCEED\n"); + } else { + printf("✅ MAC 驗證成功!\n"); + } + } + + ReaderClose(); + if (!quiet_mode) printf("=== 驗證完成 ===\n"); +} +//------------------------------------------------------------------------------ +void cli_setsdm(int argc, char *argv[]) +{ + int url_index = 1; // 預設使用第1個URL + int key_index = 1; // 預設使用第1個金鑰 + bool quiet_mode = false; + + // 解析參數 + for (int i = 2; i < argc; i++) { + if (strcmp(argv[i], "--url") == 0 && i + 1 < argc) { + url_index = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--key") == 0 && i + 1 < argc) { + key_index = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "-q") == 0) { + quiet_mode = true; + } else { + // 檢測無效參數 + if (argv[i][0] == '-') { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 錯誤:無效參數 '%s'\n", argv[i]); + printf("使用 'help' 查看正確的參數格式\n"); + } + return; + } + } + } + + if (!quiet_mode) printf("=== 快速 SDM 設定模式 ===\n"); + + // 初始化讀卡機 + UFR_STATUS status = ReaderOpen(); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("開啟讀卡機失敗: 0x%08X\n", status); + } + return; + } + + // 讀取 URL 和金鑰 + uint8_t q_url[512]; // 增加緩衝區大小支援長 URL + uint8_t q_url_len; + uint8_t q_aes_key_ext[16]; + + // 抑制讀取 URL 的輸出 + FILE *old_stdout_url = NULL; + if (quiet_mode) { + old_stdout_url = stdout; + stdout = fopen("/dev/null", "w"); + } + bool url_result = read_url_by_index(q_url, &q_url_len, url_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout_url; + } + if (!url_result) { + if (quiet_mode) { + printf("FAILED\n"); + } + ReaderClose(); + return; + } + + // 抑制讀取金鑰的輸出 + FILE *old_stdout_key = NULL; + if (quiet_mode) { + old_stdout_key = stdout; + stdout = fopen("/dev/null", "w"); + } + bool key_result = read_aes_key_by_index(q_aes_key_ext, key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout_key; + } + if (!key_result) { + if (quiet_mode) { + printf("FAILED\n"); + } + ReaderClose(); + return; + } + + // 檢查卡片類型 + uint8_t q_dl_card_type; + status = GetDlogicCardType(&q_dl_card_type); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取卡片類型失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + // 快速設定參數 + uint8_t q_file_no = 2; + uint8_t q_communication_mode = 0; + uint8_t q_read_key_no = 0x0E; + uint8_t q_write_key_no = 0x0E; + uint8_t q_read_write_key_no = 0x0E; + uint8_t q_change_key_no = 0x00; + uint8_t q_new_change_key_no = 0; + + // SDM 參數 + uint8_t q_uid_enable = 1; + uint8_t q_read_ctr_enable = 1; + uint8_t q_read_ctr_limit_enable = 0; + uint8_t q_enc_file_data_enable = 0; + uint8_t q_meta_data_key_no = 0x0E; + uint8_t q_file_data_read_key_no = 0x00; + uint8_t q_read_ctr_key_no = 0x0E; + uint32_t q_read_ctr_limit = 0; + + // 偏移量 + uint32_t q_uid_offset = 44, q_read_ctr_offset = 63, q_picc_data_offset = 0; + uint32_t q_mac_input_offset = 44, q_enc_offset = 0, q_enc_length = 0, q_mac_offset = 74; + uint8_t q_tt_status_enable = 0, q_tt_status_offset = 0; + + // 建立 NDEF 資料 + uint8_t q_ndef_data[256]; + uint8_t q_ndef_header[] = {0x00, 0x00, 0xD1, 0x01, 0x00, 0x55, 0x00}; + uint16_t q_bytes_written; + + memset(q_ndef_data, 0, 256); + memcpy(&q_ndef_data[7], q_url, q_url_len); + + // 檢查 URL 是否已經包含參數,決定使用 ? 還是 & + if (url_has_parameters(q_url, q_url_len)) { + q_ndef_data[q_url_len + 7] = '&'; + } else { + q_ndef_data[q_url_len + 7] = '?'; + } + q_url_len++; + + // 加入 UID 參數 + q_ndef_data[q_url_len + 7] = 'u'; + q_ndef_data[q_url_len + 8] = 'i'; + q_ndef_data[q_url_len + 9] = 'd'; + q_ndef_data[q_url_len + 10] = '='; + memset(&q_ndef_data[q_url_len + 11], '0', 14); + q_uid_offset = q_url_len + 11; + q_url_len += 18; + + // 加入讀取計數器參數 + q_ndef_data[q_url_len + 7] = '&'; + q_url_len++; + q_ndef_data[q_url_len + 7] = 'c'; + q_ndef_data[q_url_len + 8] = 't'; + q_ndef_data[q_url_len + 9] = 'r'; + q_ndef_data[q_url_len + 10] = '='; + memset(&q_ndef_data[q_url_len + 11], '0', 6); + q_read_ctr_offset = q_url_len + 11; + q_url_len += 10; + + // 加入 CMAC 參數 + q_ndef_data[q_url_len + 7] = '&'; + q_url_len++; + q_ndef_data[q_url_len + 7] = 'c'; + q_ndef_data[q_url_len + 8] = 'm'; + q_ndef_data[q_url_len + 9] = 'a'; + q_ndef_data[q_url_len + 10] = 'c'; + q_ndef_data[q_url_len + 11] = '='; + memset(&q_ndef_data[q_url_len + 12], '0', 16); + q_mac_input_offset = q_url_len + 12; + q_mac_offset = q_url_len + 12; + q_url_len += 21; + + // 設定 NDEF 標頭 + q_ndef_header[1] = q_url_len + 5; + q_ndef_header[4] = q_url_len + 1; + memcpy(q_ndef_data, q_ndef_header, 7); + + if (!quiet_mode) printf("正在設定 SDM 功能...\n"); + + // 設定檔案設定 + if(q_dl_card_type == DL_NTAG_424_DNA_TT) + status = nt4h_tt_change_sdm_file_settings_pk(q_aes_key_ext, q_file_no, q_change_key_no, 3, + q_communication_mode, q_read_key_no, q_write_key_no, q_read_write_key_no, q_change_key_no, + q_uid_enable, q_read_ctr_enable, q_read_ctr_limit_enable, q_enc_file_data_enable, + q_meta_data_key_no, q_file_data_read_key_no, q_read_ctr_key_no, + q_uid_offset, q_read_ctr_offset, q_picc_data_offset, + q_mac_input_offset, q_enc_offset, q_enc_length, q_mac_offset, q_read_ctr_limit, + q_tt_status_enable, q_tt_status_offset); + else + status = nt4h_change_sdm_file_settings_pk(q_aes_key_ext, q_file_no, q_change_key_no, 3, + q_communication_mode, q_read_key_no, q_write_key_no, q_read_write_key_no, q_change_key_no, + q_uid_enable, q_read_ctr_enable, q_read_ctr_limit_enable, q_enc_file_data_enable, + q_meta_data_key_no, q_file_data_read_key_no, q_read_ctr_key_no, + q_uid_offset, q_read_ctr_offset, q_picc_data_offset, + q_mac_input_offset, q_enc_offset, q_enc_length, q_mac_offset, q_read_ctr_limit); + + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("設定檔案設定失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + // 設定全域參數 + status = nt4h_set_global_parameters(q_file_no, q_write_key_no, q_communication_mode); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("設定全域參數失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + // 寫入 NDEF 資料 + status = LinearWrite(q_ndef_data, 0, q_url_len + 8, &q_bytes_written, T4T_WITHOUT_PWD_AUTH, 0); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("寫入 NDEF 資料失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (quiet_mode) { + printf("SUCCEED\n"); + } else { + printf("✅ 快速 SDM 設定完成!\n"); + printf("URL: %s\n", &q_ndef_data[7]); + printf("包含: UID 鏡像、讀取計數器、CMAC 驗證\n"); + printf("=== SDM 設定完成 ===\n"); + } + + ReaderClose(); +} +//------------------------------------------------------------------------------ +void cli_getuid(int argc, char *argv[]) +{ + int key_index = 1; // 預設使用第1個金鑰 + uint8_t key_no = 0; // 預設金鑰編號 0 + bool quiet_mode = false; + + // 解析參數 + for (int i = 2; i < argc; i++) { + if (strcmp(argv[i], "--key") == 0 && i + 1 < argc) { + key_index = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "-q") == 0) { + quiet_mode = true; + } else { + // 檢測無效參數 + if (argv[i][0] == '-') { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 錯誤:無效參數 '%s'\n", argv[i]); + printf("使用 'help' 查看正確的參數格式\n"); + } + return; + } + } + } + + if (!quiet_mode) printf("=== 讀取 UID 模式 ===\n"); + + // 初始化讀卡機 + UFR_STATUS status = ReaderOpen(); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("開啟讀卡機失敗: 0x%08X\n", status); + } + return; + } + + // 讀取金鑰 + uint8_t auth_key[16]; + FILE *old_stdout_getuid = NULL; + if (quiet_mode) { + old_stdout_getuid = stdout; + stdout = fopen("/dev/null", "w"); + } + bool key_result_getuid = read_aes_key_by_index(auth_key, key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout_getuid; + } + if (!key_result_getuid) { + if (quiet_mode) { + printf("FAILED\n"); + } + ReaderClose(); + return; + } + + // 讀取 UID + uint8_t uid[7]; + status = nt4h_get_uid_pk(auth_key, key_no, uid); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取 UID 失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (quiet_mode) { + printf("SUCCEED\n"); + } else { + printf("成功讀取 UID: "); + print_hex_ln(uid, 7, ":"); + printf("=== UID 讀取完成 ===\n"); + } + + ReaderClose(); +} +//------------------------------------------------------------------------------ +void cli_changekey(int argc, char *argv[]) +{ + int auth_key_index = 1; // 預設使用第1個認證金鑰 + int new_key_index = 1; // 預設使用第1個新金鑰 + int old_key_index = 1; // 預設使用第1個舊金鑰 + uint8_t key_no = 0; // 預設要變更的金鑰編號 + bool quiet_mode = false; + + // 解析參數 + for (int i = 2; i < argc; i++) { + if (strcmp(argv[i], "--auth-key") == 0 && i + 1 < argc) { + auth_key_index = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--new-key") == 0 && i + 1 < argc) { + new_key_index = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--old-key") == 0 && i + 1 < argc) { + old_key_index = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--key-no") == 0 && i + 1 < argc) { + key_no = atoi(argv[i + 1]); + i++; + } else if (strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "-q") == 0) { + quiet_mode = true; + } else { + // 檢測無效參數 + if (argv[i][0] == '-') { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 錯誤:無效參數 '%s'\n", argv[i]); + printf("使用 'help' 查看正確的參數格式\n"); + } + return; + } + } + } + + if (!quiet_mode) printf("=== 變更 AES 金鑰模式 ===\n"); + + // 初始化讀卡機 + UFR_STATUS status = ReaderOpen(); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("開啟讀卡機失敗: 0x%08X\n", status); + } + return; + } + + // 讀取認證金鑰 + uint8_t auth_key[16]; + FILE *old_stdout = NULL; + if (quiet_mode) { + old_stdout = stdout; + stdout = fopen("/dev/null", "w"); + } + bool auth_key_result = read_aes_key_by_index(auth_key, auth_key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout; + } + if (!auth_key_result) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取認證金鑰失敗\n"); + } + ReaderClose(); + return; + } + + // 讀取新金鑰 + uint8_t new_key[16]; + if (quiet_mode) { + old_stdout = stdout; + stdout = fopen("/dev/null", "w"); + } + bool new_key_result = read_aes_key_by_index(new_key, new_key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout; + } + if (!new_key_result) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取新金鑰失敗\n"); + } + ReaderClose(); + return; + } + + // 讀取舊金鑰 + uint8_t old_key[16]; + if (quiet_mode) { + old_stdout = stdout; + stdout = fopen("/dev/null", "w"); + } + bool old_key_result = read_aes_key_by_index(old_key, old_key_index); + if (quiet_mode) { + fclose(stdout); + stdout = old_stdout; + } + if (!old_key_result) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("讀取舊金鑰失敗\n"); + } + ReaderClose(); + return; + } + + if (!quiet_mode) { + printf("認證金鑰索引: %d\n", auth_key_index); + printf("新金鑰索引: %d\n", new_key_index); + printf("舊金鑰索引: %d\n", old_key_index); + printf("金鑰編號: %d\n", key_no); + printf("正在變更金鑰...\n"); + } + + // 執行金鑰變更 + status = nt4h_change_key_pk(auth_key, key_no, new_key, old_key); + if(status) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("變更金鑰失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (quiet_mode) { + printf("SUCCEED\n"); + } else { + printf("✅ 成功變更金鑰!\n"); + printf("=== 金鑰變更完成 ===\n"); + } + + ReaderClose(); +} +//------------------------------------------------------------------------------ +void simple_ndef_read(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 讀取單純 NDEF \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t data[256]; + uint16_t bytes_read; + + // 讀取 NDEF 檔案(從地址 0 開始,讀取前 256 位元組) + status = LinearRead(data, 0, 256, &bytes_read, T4T_WITHOUT_PWD_AUTH, 0); + + if(status != UFR_OK) + { + printf("\n❌ NDEF 讀取失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("\n✅ 成功讀取 NDEF 檔案!\n"); + printf("讀取位元組數: %d\n", bytes_read); + + // 顯示原始十六進位資料 + printf("\n📄 原始十六進位資料:\n"); + print_hex_ln(data, (bytes_read > 32) ? 32 : bytes_read, " "); + + // 檢查是否為空白檔案 + if (data[0] == 0x00 && data[1] == 0x00) { + printf("\n⚠️ 檢測到空白 NDEF 檔案\n"); + printf("這可能是新卡片或尚未設定的卡片\n"); + return; + } + + // 解析 NDEF 標頭 + if (data[2] == 0xD1 && data[3] == 0x01 && data[5] == 0x55) { + uint8_t payload_length = data[4]; + printf("\n📝 NDEF 內容:\n"); + printf("類型: URL 記錄\n"); + printf("載荷長度: %d 位元組\n", payload_length); + + // 顯示 URL 內容(從位置 7 開始) + if (payload_length > 1 && payload_length < 200) { + printf("URL: "); + for (int i = 7; i < 7 + payload_length; i++) { + if (data[i] >= 32 && data[i] <= 126) { // 可顯示的 ASCII 字符 + printf("%c", data[i]); + } else { + printf("."); + } + } + printf("\n"); + } + } else { + printf("\n⚠️ 非標準 URL NDEF 格式\n"); + printf("NDEF 標頭: %02X %02X %02X %02X %02X %02X %02X\n", + data[0], data[1], data[2], data[3], data[4], data[5], data[6]); + + // 嘗試顯示可讀取的文字內容 + printf("\n📝 可能的文字內容:\n"); + for (int i = 0; i < bytes_read && i < 100; i++) { + if (data[i] >= 32 && data[i] <= 126) { + printf("%c", data[i]); + } else if (data[i] == 0) { + printf("."); + } else { + printf("?"); + } + } + printf("\n"); + } +} +//------------------------------------------------------------------------------ +void cli_readndef(int argc, char *argv[]) +{ + bool quiet_mode = false; + + // 解析命令行參數 + for (int i = 2; i < argc; i++) { + if (strcmp(argv[i], "--quiet") == 0) { + quiet_mode = true; + } else { + if (!quiet_mode) { + printf("❌ 未知參數: %s\n", argv[i]); + printf("用法: ./nt4h_c_example readndef [--quiet]\n"); + } + return; + } + } + + if (!quiet_mode) { + printf("=== 單純 NDEF 讀取模式 ===\n"); + } + + UFR_STATUS status = ReaderOpen(); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 開啟讀卡機失敗: 0x%08X\n", status); + } + return; + } + + if (!quiet_mode) { + printf("✅ 讀卡機已開啟\n"); + printf("請將卡片放在讀卡機上...\n"); + } + + uint8_t data[256]; + uint16_t bytes_read; + + // 讀取 NDEF 檔案(從地址 0 開始,讀取前 256 位元組) + status = LinearRead(data, 0, 256, &bytes_read, T4T_WITHOUT_PWD_AUTH, 0); + + if(status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ NDEF 讀取失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (!quiet_mode) { + printf("✅ 成功讀取 NDEF 檔案!\n"); + printf("讀取位元組數: %d\n", bytes_read); + } + + // 檢查是否為空白檔案 + if (data[0] == 0x00 && data[1] == 0x00) { + if (quiet_mode) { + printf("EMPTY\n"); + } else { + printf("⚠️ 檢測到空白 NDEF 檔案\n"); + printf("這可能是新卡片或尚未設定的卡片\n"); + } + ReaderClose(); + return; + } + + // 解析 NDEF 標頭 + if (data[2] == 0xD1 && data[3] == 0x01 && data[5] == 0x55) { + uint8_t payload_length = data[4]; + + // 顯示 URL 內容(從位置 7 開始) + if (payload_length > 1 && payload_length < 250) { + if (quiet_mode) { + // 只輸出 URL,方便腳本處理 + for (int i = 7; i < 7 + payload_length; i++) { + if (data[i] >= 32 && data[i] <= 126) { // 可顯示的 ASCII 字符 + printf("%c", data[i]); + } + } + printf("\n"); + } else { + printf("類型: URL 記錄\n"); + printf("載荷長度: %d 位元組\n", payload_length); + printf("URL: "); + for (int i = 7; i < 7 + payload_length; i++) { + if (data[i] >= 32 && data[i] <= 126) { // 可顯示的 ASCII 字符 + printf("%c", data[i]); + } else { + printf("."); + } + } + printf("\n"); + } + } else { + if (quiet_mode) { + printf("INVALID_LENGTH\n"); + } else { + printf("❌ 無效的載荷長度: %d\n", payload_length); + } + ReaderClose(); + return; + } + } else { + if (quiet_mode) { + printf("NON_STANDARD\n"); + } else { + printf("⚠️ 非標準 URL NDEF 格式\n"); + printf("NDEF 標頭: %02X %02X %02X %02X %02X %02X %02X\n", + data[0], data[1], data[2], data[3], data[4], data[5], data[6]); + } + ReaderClose(); + return; + } + + if (!quiet_mode) { + printf("📱 此為標準 NDEF URL 記錄,可被任何 NFC 設備讀取\n"); + } + + ReaderClose(); +} +//------------------------------------------------------------------------------ +void simple_ndef_write(void) +{ + printf(" -------------------------------------------------------------------\n"); + printf(" 寫入單純 NDEF \n"); + printf(" -------------------------------------------------------------------\n"); + + UFR_STATUS status; + uint8_t url[200]; + uint8_t url_len = 0; + uint8_t ndef_data[256]; + uint16_t bytes_written; + + printf("請輸入要寫入的 URL (例如: https://example.com): "); + fflush(stdout); + + // 讀取用戶輸入的 URL + if (fgets((char*)url, sizeof(url), stdin) != NULL) { + // 移除換行符號 + size_t len = strlen((char*)url); + if (len > 0 && url[len-1] == '\n') { + url[len-1] = '\0'; + len--; + } + url_len = (uint8_t)len; + } + + if (url_len == 0 || url_len > 240) { + printf("❌ URL 長度無效(應該在 1-240 字符之間)\n"); + printf("💡 NTAG424 NDEF 區域最大約可容納 240 字符的 URL\n"); + return; + } + + printf("準備寫入 URL: %s\n", url); + printf("URL 長度: %d 字符\n", url_len); + + // 建立 NDEF 資料結構 + memset(ndef_data, 0, sizeof(ndef_data)); + + // NDEF 標頭: [總長度高位] [總長度低位] [記錄標頭] [類型長度] [載荷長度] [類型] [URL前綴] + ndef_data[0] = 0x00; // NDEF 訊息長度 (高位) + ndef_data[1] = url_len + 5; // NDEF 訊息長度 (低位) = 標頭(3) + 類型(1) + URL前綴(1) + URL內容 + ndef_data[2] = 0xD1; // NDEF 記錄標頭 (MB=1, ME=1, CF=0, SR=1, IL=0, TNF=1) + ndef_data[3] = 0x01; // 類型長度 = 1 + ndef_data[4] = url_len + 1; // 載荷長度 = URL前綴(1) + URL內容 + ndef_data[5] = 0x55; // 類型 = 'U' (URL) + ndef_data[6] = 0x00; // URL 前綴 (0x00 = 無前綴) + + // 複製 URL 內容 + memcpy(&ndef_data[7], url, url_len); + + // 計算總寫入長度 (標頭 7 字節 + URL 內容) + uint16_t total_len = 7 + url_len; + + printf("\n📝 NDEF 資料結構:\n"); + printf("NDEF 標頭: %02X %02X %02X %02X %02X %02X %02X\n", + ndef_data[0], ndef_data[1], ndef_data[2], ndef_data[3], + ndef_data[4], ndef_data[5], ndef_data[6]); + printf("總寫入長度: %d 位元組\n", total_len); + + printf("\n正在寫入 NDEF 資料...\n"); + + // 寫入 NDEF 資料到卡片(無需金鑰認證的明文模式) + status = LinearWrite(ndef_data, 0, total_len, &bytes_written, T4T_WITHOUT_PWD_AUTH, 0); + + if(status != UFR_OK) + { + printf("\n❌ NDEF 寫入失敗\n"); + printf("錯誤碼 = 0x%08X\n", status); + return; + } + + printf("\n✅ 成功寫入 NDEF 資料!\n"); + printf("寫入位元組數: %d\n", bytes_written); + printf("URL: %s\n", url); + printf("\n📱 現在可以用手機 NFC 讀取此卡片,會自動開啟該 URL\n"); + printf("💡 此為單純 NDEF 寫入,未啟用 SDM 動態驗證功能\n"); +} +//------------------------------------------------------------------------------ +void cli_writendef(int argc, char *argv[]) +{ + char *url_to_write = NULL; + int url_index = 0; // 從檔案讀取的 URL 索引 + bool quiet_mode = false; + bool use_file = false; + + // 解析命令行參數 + for (int i = 2; i < argc; i++) { + if (strcmp(argv[i], "--url") == 0 && i + 1 < argc) { + url_to_write = argv[i + 1]; + i++; + } else if (strcmp(argv[i], "--url-index") == 0 && i + 1 < argc) { + url_index = atoi(argv[i + 1]); + use_file = true; + i++; + } else if (strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "-q") == 0) { + quiet_mode = true; + } + } + + // 處理從檔案讀取 URL + uint8_t file_url[512]; + uint8_t file_url_len; + + if (use_file) { + if (url_index < 1) { + if (!quiet_mode) { + printf("錯誤:URL 索引必須大於 0\n"); + printf("用法: ./nt4h_c_example writendef --url-index <索引>\n"); + } + return; + } + + // 從檔案讀取 URL (在 CLI 模式中抑制輸出) + FILE *old_stdout = stdout; + stdout = fopen("/dev/null", "w"); + bool result = read_url_by_index(file_url, &file_url_len, url_index); + fclose(stdout); + stdout = old_stdout; + + if (!result) { + if (!quiet_mode) { + printf("❌ 從檔案讀取 URL 失敗\n"); + } + return; + } + url_to_write = (char*)file_url; + } + + if (url_to_write == NULL) { + if (!quiet_mode) { + printf("錯誤:需要指定 --url 或 --url-index <索引> 參數\n"); + printf("用法1: ./nt4h_c_example writendef --url \"\"\n"); + printf("用法2: ./nt4h_c_example writendef --url-index <索引>\n"); + printf("範例1: ./nt4h_c_example writendef --url \"https://example.com\"\n"); + printf("範例2: ./nt4h_c_example writendef --url-index 4\n"); + } + return; + } + + size_t url_len = strlen(url_to_write); + if (url_len == 0 || url_len > 240) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ URL 長度無效(應該在 1-240 字符之間)\n"); + printf("💡 當前 URL 長度: %zu 字符\n", url_len); + } + return; + } + + if (!quiet_mode) { + printf("=== 單純 NDEF 寫入模式 ===\n"); + printf("目標 URL: %s\n", url_to_write); + printf("URL 長度: %zu 字符\n", url_len); + } + + // 開啟讀卡機 + UFR_STATUS status = ReaderOpen(); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 開啟讀卡機失敗: 0x%08X\n", status); + } + return; + } + + if (!quiet_mode) { + printf("✅ 讀卡機已開啟\n"); + printf("請將卡片放在讀卡機上...\n"); + } + + // 第一步:先徹底禁用 SDM 功能(避免記憶體佈局衝突) + if (!quiet_mode) printf("正在禁用 SDM 功能...\n"); + + uint8_t aes_key_disable[16]; + memset(aes_key_disable, 0, 16); // 使用預設金鑰 (全0) + + uint8_t file_no = 2; // NDEF 檔案 + uint8_t dl_card_type; + status = GetDlogicCardType(&dl_card_type); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 無法識別卡片類型: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + // 禁用 SDM:所有 SDM 相關參數設為 false/0 + if(dl_card_type == DL_NTAG_424_DNA_TT) { + status = nt4h_tt_change_sdm_file_settings_pk(aes_key_disable, file_no, 0, 3, // change_key_no, curr_communication_mode + 0, 0x0E, 0x0E, 0x0E, 0, // new_communication_mode, read_key, write_key, rw_key, change_key + 0, 0, 0, 0, // uid_enable=0, read_ctr_enable=0, read_ctr_limit_enable=0, enc_file_data_enable=0 + 15, 15, 15, // meta_data_key=15 (無效), file_data_read_key=15, read_ctr_key=15 + 0, 0, 0, // uid_offset=0, read_ctr_offset=0, picc_data_offset=0 + 0, 0, 0, 0, 0, // mac_input_offset=0, enc_offset=0, enc_length=0, mac_offset=0, read_ctr_limit=0 + 0, 0); // tt_status_enable=0, tt_status_offset=0 + } else { + status = nt4h_change_sdm_file_settings_pk(aes_key_disable, file_no, 0, 3, // change_key_no, curr_communication_mode + 0, 0x0E, 0x0E, 0x0E, 0, // new_communication_mode, read_key, write_key, rw_key, change_key + 0, 0, 0, 0, // 禁用所有 SDM 功能 + 15, 15, 15, // meta_data_key=15, file_data_read_key=15, read_ctr_key=15 + 0, 0, 0, // uid_offset=0, read_ctr_offset=0, picc_data_offset=0 + 0, 0, 0, 0, 0); // mac_input_offset=0, enc_offset=0, enc_length=0, mac_offset=0, read_ctr_limit=0 + } + + if (status != UFR_OK && !quiet_mode) { + printf("⚠️ SDM 禁用失敗,繼續寫入: 0x%08X\n", status); + } else if (!quiet_mode) { + printf("✅ SDM 功能已禁用\n"); + } + + // 第二步:建立 NDEF 資料結構 + uint8_t ndef_data[256]; + memset(ndef_data, 0, sizeof(ndef_data)); + + // NDEF 標頭: [總長度高位] [總長度低位] [記錄標頭] [類型長度] [載荷長度] [類型] [URL前綴] + ndef_data[0] = 0x00; // NDEF 訊息長度 (高位) + ndef_data[1] = url_len + 5; // NDEF 訊息長度 (低位) = 標頭(3) + 類型(1) + URL前綴(1) + URL內容 + ndef_data[2] = 0xD1; // NDEF 記錄標頭 (MB=1, ME=1, CF=0, SR=1, IL=0, TNF=1) + ndef_data[3] = 0x01; // 類型長度 = 1 + ndef_data[4] = url_len + 1; // 載荷長度 = URL前綴(1) + URL內容 + ndef_data[5] = 0x55; // 類型 = 'U' (URL) + ndef_data[6] = 0x00; // URL 前綴 (0x00 = 無前綴) + + // 複製 URL 內容 + memcpy(&ndef_data[7], url_to_write, url_len); + + // 計算總寫入長度 (標頭 7 字節 + URL 內容) + uint16_t total_len = 7 + url_len; + + if (!quiet_mode) { + printf("正在寫入 NDEF 資料...\n"); + printf("總寫入長度: %d 位元組\n", total_len); + } + + // 先清除 NDEF 區域(避免舊 SDM 數據干擾,限制在250字節內) + uint8_t clear_data[250]; + memset(clear_data, 0, 250); + uint16_t bytes_written; + + if (!quiet_mode) printf("正在清除舊數據...\n"); + status = LinearWrite(clear_data, 0, 250, &bytes_written, T4T_WITHOUT_PWD_AUTH, 0); + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ 清除舊數據失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (!quiet_mode) printf("正在寫入新的 NDEF 資料...\n"); + + // 寫入 NDEF 資料到卡片(無需金鑰認證的明文模式) + status = LinearWrite(ndef_data, 0, total_len, &bytes_written, T4T_WITHOUT_PWD_AUTH, 0); + + if (status != UFR_OK) { + if (quiet_mode) { + printf("FAILED\n"); + } else { + printf("❌ NDEF 寫入失敗: 0x%08X\n", status); + } + ReaderClose(); + return; + } + + if (quiet_mode) { + printf("SUCCEED\n"); + } else { + printf("✅ 成功寫入 NDEF 資料!\n"); + printf("寫入位元組數: %d\n", bytes_written); + printf("URL: %s\n", url_to_write); + printf("📱 現在可以用手機 NFC 讀取此卡片,會自動開啟該 URL\n"); + printf("💡 此為單純 NDEF 寫入,未啟用 SDM 動態驗證功能\n"); + } + + ReaderClose(); +} + +//------------------------------------------------------------------------------ +// 檢查 URL 是否包含參數的輔助函數 +bool url_has_parameters(const uint8_t *url, uint8_t url_len) +{ + for (uint8_t i = 0; i < url_len; i++) { + if (url[i] == '?') { + return true; + } + } + return false; +} \ No newline at end of file diff --git a/src/uFR.c b/src/uFR.c new file mode 100644 index 0000000..8e53863 --- /dev/null +++ b/src/uFR.c @@ -0,0 +1,199 @@ +/* + * uFR.c + */ + +#include +#include +#include +#include +#include +#include "ini.h" +#include "uFR.h" + +//------------------------------------------------------------------------------ +bool CheckDependencies(void) { +#if defined(EXIT_ON_WRONG_FW_DEPENDENCY) || defined(EXIT_ON_WRONG_LIB_DEPENDENCY) + uint8_t version_major, version_minor, build; + bool wrong_version = false; +#endif + UFR_STATUS status; + +#ifdef EXIT_ON_WRONG_LIB_DEPENDENCY + uint32_t dwDllVersion = 0; + + dwDllVersion = GetDllVersion(); + + // "explode" the uFCoder library version: + version_major = (uint8_t)dwDllVersion; + version_minor = (uint8_t)(dwDllVersion >> 8); + + // Get the uFCoder library build number. + build = (uint8_t)(dwDllVersion >> 16); + + if (version_major < MIN_DEPEND_LIB_VER_MAJOR) { + wrong_version = true; + } else if (version_major == MIN_DEPEND_LIB_VER_MAJOR && version_minor < MIN_DEPEND_LIB_VER_MINOR) { + wrong_version = true; + } else if (version_major == MIN_DEPEND_LIB_VER_MAJOR && version_minor == MIN_DEPEND_LIB_VER_MINOR && build < MIN_DEPEND_LIB_VER_BUILD) { + wrong_version = true; + } + + if (wrong_version) { + printf("uFCoder 函式庫版本錯誤 (%d.%d.%d)。\n" + "請更新 uFCoder 函式庫至至少 %d.%d.%d 版本。\n", + version_major, version_minor, build, + MIN_DEPEND_LIB_VER_MAJOR, MIN_DEPEND_LIB_VER_MINOR, MIN_DEPEND_LIB_VER_BUILD); + return false; + } +#endif +#ifdef EXIT_ON_WRONG_FW_DEPENDENCY + wrong_version = false; + status = GetReaderFirmwareVersion(&version_major, &version_minor); + if (status != UFR_OK) { + printf("檢查韌體版本時發生錯誤,狀態碼:0x%08X\n", status); + } + status = GetBuildNumber(&build); + + if (status != UFR_OK) { + printf("取得韌體版本時發生錯誤,狀態碼:0x%08X\n", status); + } + if (version_major < MIN_DEPEND_FW_VER_MAJOR) { + wrong_version = true; + } else if (version_major == MIN_DEPEND_FW_VER_MAJOR && version_minor < MIN_DEPEND_FW_VER_MINOR) { + wrong_version = true; + } else if (version_major == MIN_DEPEND_FW_VER_MAJOR && version_minor == MIN_DEPEND_FW_VER_MINOR && build < MIN_DEPEND_FW_VER_BUILD) { + wrong_version = true; + } + + if (wrong_version) { + printf("uFR NFC 讀卡機韌體版本錯誤 (%d.%d.%d)。\n" + "請更新 uFR 韌體至至少 %d.%d.%d 版本。\n", + version_major, version_minor, build, + MIN_DEPEND_FW_VER_MAJOR, MIN_DEPEND_FW_VER_MINOR, MIN_DEPEND_FW_VER_BUILD); + return false; + } +#endif + return true; +} +//------------------------------------------------------------------------------ +sz_ptr GetDlTypeName(uint8_t dl_type_code) { + + switch (dl_type_code) { + case DL_MIFARE_ULTRALIGHT: + return "DL_MIFARE_ULTRALIGHT"; + case DL_MIFARE_ULTRALIGHT_EV1_11: + return "DL_MIFARE_ULTRALIGHT_EV1_11"; + case DL_MIFARE_ULTRALIGHT_EV1_21: + return "DL_MIFARE_ULTRALIGHT_EV1_21"; + case DL_MIFARE_ULTRALIGHT_C: + return "DL_MIFARE_ULTRALIGHT_C"; + case DL_NTAG_203: + return "DL_NTAG_203"; + case DL_NTAG_210: + return "DL_NTAG_210"; + case DL_NTAG_212: + return "DL_NTAG_212"; + case DL_NTAG_213: + return "DL_NTAG_213"; + case DL_NTAG_215: + return "DL_NTAG_215"; + case DL_NTAG_216: + return "DL_NTAG_216"; + case DL_MIKRON_MIK640D: + return "DL_MIKRON_MIK640D"; + case NFC_T2T_GENERIC: + return "NFC_T2T_GENERIC"; + case DL_NT3H_1101: + return "DL_NT3H_1101"; + case DL_NT3H_1201: + return "DL_NT3H_1201"; + case DL_NT3H_2111: + return "DL_NT3H_2111"; + case DL_NT3H_2211: + return "DL_NT3H_2211"; + case DL_MIFARE_MINI: + return "DL_MIFARE_MINI"; + case DL_NTAG_413_DNA: + return "DL_NTAG_413_DNA"; + case DL_NTAG_424_DNA: + return "DL_NTAG_424_DNA"; + case DL_NTAG_424_DNA_TT: + return "DL_NTAG_424_DNA_TT"; + case DL_MIFARE_CLASSIC_1K: + return "DL_MIFARE_CLASSIC_1K"; + case DL_MIFARE_CLASSIC_4K: + return "DL_MIFARE_CLASSIC_4K"; + case DL_MIFARE_PLUS_S_2K_SL0: + return "DL_MIFARE_PLUS_S_2K_SL0"; + case DL_MIFARE_PLUS_S_4K_SL0: + return "DL_MIFARE_PLUS_S_4K_SL0"; + case DL_MIFARE_PLUS_X_2K_SL0: + return "DL_MIFARE_PLUS_X_2K_SL0"; + case DL_MIFARE_PLUS_X_4K_SL0: + return "DL_MIFARE_PLUS_X_4K_SL0"; + case DL_MIFARE_DESFIRE: + return "DL_MIFARE_DESFIRE"; + case DL_MIFARE_DESFIRE_EV1_2K: + return "DL_MIFARE_DESFIRE_EV1_2K"; + case DL_MIFARE_DESFIRE_EV1_4K: + return "DL_MIFARE_DESFIRE_EV1_4K"; + case DL_MIFARE_DESFIRE_EV1_8K: + return "DL_MIFARE_DESFIRE_EV1_8K"; + case DL_MIFARE_DESFIRE_EV2_2K: + return "DL_MIFARE_DESFIRE_EV2_2K"; + case DL_MIFARE_DESFIRE_EV2_4K: + return "DL_MIFARE_DESFIRE_EV2_4K"; + case DL_MIFARE_DESFIRE_EV2_8K: + return "DL_MIFARE_DESFIRE_EV2_8K"; + case DL_MIFARE_PLUS_S_2K_SL1: + return "DL_MIFARE_PLUS_S_2K_SL1"; + case DL_MIFARE_PLUS_X_2K_SL1: + return "DL_MIFARE_PLUS_X_2K_SL1"; + case DL_MIFARE_PLUS_EV1_2K_SL1: + return "DL_MIFARE_PLUS_EV1_2K_SL1"; + case DL_MIFARE_PLUS_X_2K_SL2: + return "DL_MIFARE_PLUS_X_2K_SL2"; + case DL_MIFARE_PLUS_S_2K_SL3: + return "DL_MIFARE_PLUS_S_2K_SL3"; + case DL_MIFARE_PLUS_X_2K_SL3: + return "DL_MIFARE_PLUS_X_2K_SL3"; + case DL_MIFARE_PLUS_EV1_2K_SL3: + return "DL_MIFARE_PLUS_EV1_2K_SL3"; + case DL_MIFARE_PLUS_S_4K_SL1: + return "DL_MIFARE_PLUS_S_4K_SL1"; + case DL_MIFARE_PLUS_X_4K_SL1: + return "DL_MIFARE_PLUS_X_4K_SL1"; + case DL_MIFARE_PLUS_EV1_4K_SL1: + return "DL_MIFARE_PLUS_EV1_4K_SL1"; + case DL_MIFARE_PLUS_X_4K_SL2: + return "DL_MIFARE_PLUS_X_4K_SL2"; + case DL_MIFARE_PLUS_S_4K_SL3: + return "DL_MIFARE_PLUS_S_4K_SL3"; + case DL_MIFARE_PLUS_X_4K_SL3: + return "DL_MIFARE_PLUS_X_4K_SL3"; + case DL_MIFARE_PLUS_EV1_4K_SL3: + return "DL_MIFARE_PLUS_EV1_4K_SL3"; + case DL_GENERIC_ISO14443_4: + return "DL_GENERIC_ISO_14443_4"; + case DL_MIFARE_PLUS_SE_SL0: + return "DL_MIFARE_PLUS_SE_SL0"; + case DL_MIFARE_PLUS_SE_SL1: + return "DL_MIFARE_PLUS_SE_SL1"; + case DL_MIFARE_PLUS_SE_SL3: + return "DL_MIFARE_PLUS_SE_SL3"; + case DL_MIFARE_DESFIRE_LIGHT: + return "DL_MIFARE_DESFIRE_LIGHT"; + case DL_GENERIC_ISO14443_4_TYPE_B: + return "DL_GENERIC_ISO14443_4_TYPE_B"; + case DL_GENERIC_ISO14443_3_TYPE_B: + return "DL_GENERIC_ISO14443_3_TYPE_B"; + case DL_MIFARE_PLUS_EV1_2K_SL0: + return " DL_MIFARE_PLUS_EV1_2K_SL0"; + case DL_MIFARE_PLUS_EV1_4K_SL0: + return "DL_MIFARE_PLUS_EV1_4K_SL0"; + case DL_IMEI_UID: + return "DL_IMEI_UID"; + } + return "未知卡片"; +} +//------------------------------------------------------------------------------ diff --git a/src/uFR.h b/src/uFR.h new file mode 100644 index 0000000..8984fed --- /dev/null +++ b/src/uFR.h @@ -0,0 +1,22 @@ +/* + * uFR.h + */ + +#ifndef UFR_H_ +#define UFR_H_ + +#include "ini.h" +#include +//------------------------------------------------------------------------------ +typedef const char * sz_ptr; +//------------------------------------------------------------------------------ +bool CheckDependencies(void); +sz_ptr GetDlTypeName(uint8_t dl_type_code); +//------------------------------------------------------------------------------ +UFR_STATUS nt4h_tt_set_tag_tamper_pk(uint8_t *aes_key_ext, uint8_t key_no, uint8_t tt_permanent_lock); +UFR_STATUS nt4h_tt_set_tag_tamper(uint8_t aes_internal_key_no, uint8_t key_no, uint8_t tt_permanent_lock); +UFR_STATUS nt4h_tt_get_tag_tamper_status_pk(uint8_t *aes_key_ext, uint8_t key_no, uint8_t *tt_status); +UFR_STATUS nt4h_tt_get_tag_tamper_status(uint8_t aes_internal_key_no, uint8_t key_no, uint8_t *tt_status); +UFR_STATUS nt4h_get_ecc_signature(uint8_t *ecc_signature); +//------------------------------------------------------------------------------ +#endif /* UFR_H_ */ \ No newline at end of file diff --git a/src/utils.c b/src/utils.c new file mode 100644 index 0000000..27801db --- /dev/null +++ b/src/utils.c @@ -0,0 +1,75 @@ +/* + * utils.c + */ + +#include +#include +#include +#include "ini.h" +#include "utils.h" + +//------------------------------------------------------------------------------ +size_t hex2bin(uint8_t *dst, const char *src) { + size_t dst_len = 0; + char s_tmp[3]; + + s_tmp[2] = '\0'; + + while (*src) { + while (((char)*src < '0' || (char)*src > '9') + && ((char)*src < 'a' || (char)*src > 'f') + && ((char)*src < 'A' || (char)*src > 'F')) + src++; // skip delimiters, white spaces, etc. + + s_tmp[0] = (char) *src++; + + // Must be pair of the hex digits: + if (!(*src)) + break; + + // And again, must be pair of the hex digits: + if (((char)*src < '0' || (char)*src > '9') + && ((char)*src < 'a' || (char)*src > 'f') + && ((char)*src < 'A' || (char)*src > 'F')) + break; + + s_tmp[1] = (char) *src++; + + *dst++ = strtoul(s_tmp, NULL, 16); + dst_len++; + } + + return dst_len; +} +//------------------------------------------------------------------------------ +void print_ln_len(char symbol, uint8_t cnt) { + + for (int i = 0; i < cnt; i++) + printf("%c", symbol); + + printf("\n"); +} +//------------------------------------------------------------------------------ +inline void print_ln(char symbol) { + + print_ln_len(symbol, DEFAULT_LINE_LEN); +} +//------------------------------------------------------------------------------ +void print_hex(const uint8_t *data, uint32_t len, const char *delimiter) { + + for (int i = 0; i < len; i++) { + printf("%02X", data[i]); + if ((delimiter != NULL) && (i < (len - 1))) + printf("%c", *delimiter); + } +} +//------------------------------------------------------------------------------ +void print_hex_ln(const uint8_t *data, uint32_t len, const char *delimiter) { + + print_hex(data, len, delimiter); + printf("\n"); +} +//============================================================================== + + + diff --git a/src/utils.h b/src/utils.h new file mode 100644 index 0000000..9420a7b --- /dev/null +++ b/src/utils.h @@ -0,0 +1,16 @@ +/* + * utils.h + */ + +#ifndef UTILS_H_ +#define UTILS_H_ + +#define DEFAULT_LINE_LEN 60 + +size_t hex2bin(uint8_t *dst, const char *src); +void print_ln_len(char symbol, uint8_t cnt); +void print_ln(char symbol); +void print_hex(const uint8_t *data, uint32_t len, const char *delimiter); +void print_hex_ln(const uint8_t *data, uint32_t len, const char *delimiter); + +#endif /* UTILS_H_ */ diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..af98999 --- /dev/null +++ b/start.sh @@ -0,0 +1,211 @@ +#!/bin/bash + +# NFC 生產工具啟動腳本 +# 適用於 Linux 環境 + +set -e # 遇到錯誤立即退出 + +# 顏色定義 +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# 日誌函數 +log_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +log_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# 檢查是否在正確的目錄 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + +log_info "NFC 生產工具啟動中..." +log_info "工作目錄: $(pwd)" + +# 檢查必要檔案 +check_files() { + local missing_files=() + + if [[ ! -f "app.py" ]]; then + missing_files+=("app.py") + fi + + if [[ ! -f "requirements.txt" ]]; then + missing_files+=("requirements.txt") + fi + + if [[ ! -d "linux64_release" ]]; then + missing_files+=("linux64_release/") + fi + + if [[ ! -f "linux64_release/nt4h_c_example" ]]; then + missing_files+=("linux64_release/nt4h_c_example") + fi + + if [[ ${#missing_files[@]} -gt 0 ]]; then + log_error "缺少必要檔案:" + for file in "${missing_files[@]}"; do + echo " - $file" + done + exit 1 + fi +} + +# 檢查 Python 環境 +check_python() { + if ! command -v python3 &> /dev/null; then + log_error "Python3 未安裝,請先安裝 Python3" + exit 1 + fi + + local python_version=$(python3 --version | cut -d' ' -f2) + log_info "Python 版本: $python_version" + + # 檢查版本是否 >= 3.7 + if ! python3 -c "import sys; exit(0 if sys.version_info >= (3, 7) else 1)" 2>/dev/null; then + log_error "需要 Python 3.7 或以上版本" + exit 1 + fi +} + +# 設定虛擬環境 +setup_venv() { + if [[ ! -d "myenv" ]]; then + log_info "創建 Python 虛擬環境..." + python3 -m venv myenv + log_success "虛擬環境創建完成" + fi + + log_info "啟動虛擬環境..." + source myenv/bin/activate + + # 檢查是否需要安裝依賴 + if [[ ! -f "myenv/pyvenv.cfg" ]] || [[ ! -d "myenv/lib" ]]; then + log_error "虛擬環境損壞,請刪除 myenv 目錄後重新執行" + exit 1 + fi + + # 安裝或更新依賴 + log_info "檢查 Python 依賴套件..." + pip install --upgrade pip + pip install -r requirements.txt + log_success "依賴套件安裝完成" +} + +# 檢查 USB 權限 +check_usb_permissions() { + log_info "檢查 USB 裝置權限..." + + # 檢查 udev 規則是否存在 + if [[ ! -f "/etc/udev/rules.d/99-ufr.rules" ]]; then + log_warning "未找到 uFR udev 規則,可能無法存取 USB 裝置" + log_info "建議執行以下命令設定 USB 權限:" + echo "sudo tee /etc/udev/rules.d/99-ufr.rules << EOF" + echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6001\", MODE=\"0666\"" + echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"0403\", ATTRS{idProduct}==\"6014\", MODE=\"0666\"" + echo "EOF" + echo "sudo udevadm control --reload-rules" + echo "sudo udevadm trigger" + fi + + # 檢查當前使用者是否在 dialout 群組 + if ! groups | grep -q dialout; then + log_warning "當前使用者不在 dialout 群組中" + log_info "建議執行:sudo usermod -a -G dialout \$USER" + fi +} + +# 設定檔案權限 +set_permissions() { + log_info "設定檔案權限..." + + chmod +x linux64_release/nt4h_c_example 2>/dev/null || true + chmod +x linux64_release/libnt4h_c.so 2>/dev/null || true + + # 設定設定檔權限 + if [[ -f "linux64_release/keys.txt" ]]; then + chmod 666 linux64_release/keys.txt 2>/dev/null || true + fi + + if [[ -f "linux64_release/urls.txt" ]]; then + chmod 666 linux64_release/urls.txt 2>/dev/null || true + fi + + log_success "權限設定完成" +} + +# 檢查網路端口 +check_port() { + local port=5000 + + if netstat -tuln 2>/dev/null | grep -q ":$port "; then + log_warning "端口 $port 已被佔用" + log_info "請檢查是否有其他實例正在執行" + return 1 + fi + + log_success "端口 $port 可用" + return 0 +} + +# 顯示啟動資訊 +show_startup_info() { + echo + log_success "=== NFC 生產工具啟動成功 ===" + echo + log_info "Web 介面: http://localhost:5000" + log_info "按 Ctrl+C 停止服務" + echo + log_info "系統資訊:" + echo " - 作業系統: $(uname -s) $(uname -r)" + echo " - 架構: $(uname -m)" + echo " - Python: $(python3 --version)" + echo " - 工作目錄: $(pwd)" + echo +} + +# 主執行流程 +main() { + echo "==========================================" + echo " NFC 生產工具 - Linux 啟動腳本" + echo "==========================================" + echo + + # 執行檢查 + check_files + check_python + setup_venv + check_usb_permissions + set_permissions + + # 檢查端口 + if ! check_port; then + log_error "無法啟動服務,端口被佔用" + exit 1 + fi + + # 顯示啟動資訊 + show_startup_info + + # 啟動 Flask 應用程式 + log_info "啟動 Flask 應用程式..." + python app.py +} + +# 執行主函數 +main "$@" + diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..f9089f9 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,1778 @@ + + + + + + NFC 生產工具 + + + + +
+
+

🔧 NFC 生產工具

+

專業的 NFC 卡片生產與認證系統

+
+ + + +
+ +
+

🎯 選擇設定

+
+
+ + +
+
+ +
+ + +
+
+
+ +
+
+ + +
+ +
+
+
+
+ + +
+ +
+
+
📊 執行結果
+
+
+ 閒置 +
+
+
+ WebSocket 未連接 +
+
+ + + +
+
+
+
+ + +
+

🎮 主要操作

+ + +
+

🔐 SDM 加密

+
+ + + + + +
+
+ + +
+

📄 無 SDM 加密

+
+ + +
+
+ + +
+
+ + +
+

🌐 API 設定

+
+ + + +
+
+ + + +
+
+ 未設定 +
+
+
+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/manual_test.html b/templates/manual_test.html new file mode 100644 index 0000000..96fe3a2 --- /dev/null +++ b/templates/manual_test.html @@ -0,0 +1,1156 @@ + + + + + + NT4H 手動測試工具 + + + + +
+
+

🧪 NFC 手動測試工具

+

專業的 NFC 卡片手動測試與診斷系統

+
+ + + +
+
+
+

📊 執行輸出

+
+
等待執行命令...
+
+
+
+ + +
+
+
+ +
+ +
+

🔐 快速 SDM 設定

+
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+
+ + +
+

📄 NDEF 操作 (無 SDM)

+
+
+ +
+ + +
+
+
+ + +
+
+
+ + +
+

🔑 變更 AES 金鑰

+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+
+ + +
+

📖 讀取 UID

+
+
+ + +
+
+ + +
+ +
+
+ + +
+
+ + +
+

📚 NT4H CLI 工具說明

+
+

用法:

+ ./nt4h_c_example <命令> [選項] + +

可用命令:

+
    +
  • verify [--key <索引>] - CMAC 驗證現有標籤
  • +
  • setsdm [--url <索引>] [--key <索引>] - 快速 SDM 設定
  • +
  • writendef --url <URL> 或 --url-index <索引> - 寫入單純 NDEF (無 SDM)
  • +
  • changekey [--auth-key <索引>] [--new-key <索引>] [--old-key <索引>] [--key-no <編號>] - 變更 AES 金鑰
  • +
  • getuid [--key <索引>] - 讀取 UID
  • +
  • readndef - 讀取單純 NDEF (無 SDM)
  • +
  • help - 顯示完整說明
  • +
+ +

常用選項:

+
    +
  • --key <索引> - 使用 keys.txt 中第 <索引> 個金鑰 (1-based)
  • +
  • --url <索引> - 使用 urls.txt 中第 <索引> 個 URL (1-based)
  • +
  • --url-index <索引> - 手動驗證模式中使用的 URL 索引 (1-based)
  • +
  • --auth-key <索引> - 使用 keys.txt 中第 <索引> 個金鑰作為認證金鑰
  • +
  • --new-key <索引> - 使用 keys.txt 中第 <索引> 個金鑰作為新金鑰
  • +
  • --old-key <索引> - 使用 keys.txt 中第 <索引> 個金鑰作為舊金鑰
  • +
  • --key-no <編號> - 指定要變更的金鑰編號 (0-4)
  • +
  • --manual - 手動驗證模式
  • +
  • --uid <UID> - 指定 UID (14位十六進位)
  • +
  • --ctr <計數器> - 指定計數器 (6位十六進位)
  • +
  • --cmac <CMAC> - 指定 CMAC (16位十六進位)
  • +
  • --quiet, -q - 安靜模式,只輸出 SUCCEED 或 FAILED
  • +
+ +

常用範例:

+
    +
  • ./nt4h_c_example verify --key 1 - 使用金鑰1進行CMAC驗證
  • +
  • ./nt4h_c_example verify --manual --uid 0456735AD51F90 --ctr 0000B1 --cmac C2DEEE0FF07E7EC4 - 手動驗證模式
  • +
  • ./nt4h_c_example verify --manual --url "https://nodered.contree.app/nfc?uid=0456735AD51F90&ctr=0000B1&cmac=C2DEEE0FF07E7EC4" - 使用完整URL驗證
  • +
  • ./nt4h_c_example setsdm --quiet --url 1 --key 2 - 安靜模式設定SDM
  • +
  • ./nt4h_c_example getuid --quiet --key 3 - 安靜模式讀取UID
  • +
  • ./nt4h_c_example changekey --auth-key 1 --new-key 2 --old-key 1 --key-no 1 - 變更金鑰
  • +
  • ./nt4h_c_example writendef --url "https://example.com/my-url" - 寫入自定義URL
  • +
  • ./nt4h_c_example help - 顯示完整說明
  • +
+
+
+
+
+ + + + + + + diff --git a/test_arm_build.sh b/test_arm_build.sh new file mode 100644 index 0000000..caea635 --- /dev/null +++ b/test_arm_build.sh @@ -0,0 +1,191 @@ +#!/bin/bash + +# NTAG424 ARM 編譯測試腳本 +# 展示所有 ARM 編譯選項和問題排除 + +set -e + +echo "🔧 NTAG424 ARM 編譯測試" +echo "=========================================" +echo "" + +# 檢查交叉編譯工具 +echo "📋 檢查交叉編譯工具..." +make check-cross-tools +echo "" + +# 顯示可用編譯選項 +echo "🎯 可用的 ARM 編譯選項:" +echo "" +echo "✅ 動態連結版本 (推薦):" +echo " make arm64 # ARM 64-bit (aarch64)" +echo " make arm32 # ARM 32-bit (armhf)" +echo " make armel # ARM 軟浮點 (armel)" +echo "" +echo "⚠️ 靜態連結版本 (目前有問題):" +echo " make arm64-static # 會遇到 FTDI/libtomcrypt 依賴問題" +echo " make arm32-static # 會遇到 FTDI/libtomcrypt 依賴問題" +echo "" + +# 詢問用戶要測試哪個版本 +echo "請選擇要測試的編譯選項:" +echo " (1) ARM64 動態版本 (推薦)" +echo " (2) ARM32 動態版本 (推薦)" +echo " (3) ARMEL 版本" +echo " (4) ARM64 靜態版本 (展示問題)" +echo " (5) ARM32 靜態版本 (展示問題)" +echo " (6) 全部測試" +echo " (0) 退出" +echo "" + +read -p "請選擇 (0-6): " choice + +case $choice in + 1) + echo "" + echo "🚀 編譯 ARM64 動態版本..." + make arm64 + echo "" + echo "✅ ARM64 動態版本編譯成功!" + echo "📁 輸出目錄: arm64_release/" + echo "📚 需要函式庫: ufr-lib/linux/aarch64/" + ;; + 2) + echo "" + echo "🚀 編譯 ARM32 動態版本..." + make arm32 + echo "" + echo "✅ ARM32 動態版本編譯成功!" + echo "📁 輸出目錄: arm32_release/" + echo "📚 需要函式庫: ufr-lib/linux/arm-hf/" + ;; + 3) + echo "" + echo "🚀 編譯 ARMEL 版本..." + make armel + echo "" + echo "✅ ARMEL 版本編譯成功!" + echo "📁 輸出目錄: armel_release/" + echo "📚 需要函式庫: ufr-lib/linux/arm-el/" + ;; + 4) + echo "" + echo "⚠️ 嘗試編譯 ARM64 靜態版本 (預期會失敗)..." + echo "這將展示靜態連結的已知問題..." + echo "" + if make arm64-static; then + echo "✅ 意外成功!ARM64 靜態版本編譯完成。" + else + echo "" + echo "❌ 如預期,ARM64 靜態編譯失敗。" + echo "" + echo "🔍 常見錯誤分析:" + echo "• undefined reference to 'FT_Close' - 缺少 FTDI 函式庫" + echo "• undefined reference to 'ecc_find_curve' - 缺少 libtomcrypt" + echo "• multiple definition of 'hex2bin' - 符號衝突" + echo "" + echo "💡 解決方案:" + echo "• 使用動態連結版本: make arm64" + echo "• 部署時包含函式庫目錄: ufr-lib/linux/aarch64/" + fi + ;; + 5) + echo "" + echo "⚠️ 嘗試編譯 ARM32 靜態版本 (預期會失敗)..." + echo "這將展示靜態連結的已知問題..." + echo "" + if make arm32-static; then + echo "✅ 意外成功!ARM32 靜態版本編譯完成。" + else + echo "" + echo "❌ 如預期,ARM32 靜態編譯失敗。" + echo "" + echo "🔍 常見錯誤分析:" + echo "• undefined reference to 'FT_Close' - 缺少 FTDI 函式庫" + echo "• undefined reference to 'ecc_find_curve' - 缺少 libtomcrypt" + echo "• multiple definition of 'hex2bin' - 符號衝突" + echo "" + echo "💡 解決方案:" + echo "• 使用動態連結版本: make arm32" + echo "• 部署時包含函式庫目錄: ufr-lib/linux/arm-hf/" + fi + ;; + 6) + echo "" + echo "🚀 測試所有 ARM 編譯選項..." + echo "" + + # 測試動態版本 + echo "📋 測試動態連結版本:" + echo "" + + echo "• ARM64 動態版本..." + if make arm64; then + echo " ✅ 成功" + else + echo " ❌ 失敗" + fi + + echo "• ARM32 動態版本..." + if make arm32; then + echo " ✅ 成功" + else + echo " ❌ 失敗" + fi + + echo "• ARMEL 版本..." + if make armel; then + echo " ✅ 成功" + else + echo " ❌ 失敗" + fi + + echo "" + echo "📋 測試靜態連結版本 (預期會失敗):" + echo "" + + echo "• ARM64 靜態版本..." + if make arm64-static 2>/dev/null; then + echo " ✅ 意外成功" + else + echo " ❌ 如預期失敗 (缺少靜態依賴)" + fi + + echo "• ARM32 靜態版本..." + if make arm32-static 2>/dev/null; then + echo " ✅ 意外成功" + else + echo " ❌ 如預期失敗 (缺少靜態依賴)" + fi + + echo "" + echo "📊 測試總結:" + echo "• 動態連結版本: 完全支援 ✅" + echo "• 靜態連結版本: 有已知問題 ⚠️" + echo "• 建議使用動態版本進行部署" + ;; + 0) + echo "退出測試" + exit 0 + ;; + *) + echo "無效選擇" + exit 1 + ;; +esac + +echo "" +echo "🎯 部署指南:" +echo "" +echo "1. 動態版本部署 (推薦):" +echo " scp arm64_release/nt4h_c_example user@arm-device:" +echo " scp -r ufr-lib/linux/aarch64/ user@arm-device:ufr-lib" +echo " ssh user@arm-device 'export LD_LIBRARY_PATH=./ufr-lib:\$LD_LIBRARY_PATH'" +echo "" +echo "2. 使用部署腳本:" +echo " ./deploy_arm.sh <主機> <使用者> <架構>" +echo "" +echo "3. 查看完整指南:" +echo " cat ARM_BUILD_GUIDE.md" +echo "" +echo "✅ 測試完成!" \ No newline at end of file diff --git a/ufr-lib/README.md b/ufr-lib/README.md new file mode 100644 index 0000000..fb4b250 --- /dev/null +++ b/ufr-lib/README.md @@ -0,0 +1,121 @@ + +# uFCoder libraries + +Scope of this project are libraries used with **uFR** and **uFR Zero** Series devices and SDK examples. +Libraries are supported at following platforms: +Windows 32 and 64 bit (static and dynamic) +Windows ARM64 (dynamic only) +Linux 32 and 64 bit (dynamic & static) +Linux ARM and ARM-HF (dynamic & static) +Mac OSX 64 bit & Universal (dynamic only) +iOS 64 bit (static & framework) +Android ARM 64 bit (.aar) +ESP32 ESP-IDF component + +## Getting Started + +Download project, choose appropriate architecture and place a library in appropriate directory. +Consult documentation for [API reference](https://code.d-logic.com/nfc-rfid-reader-sdk/ufr-doc/-/blob/master/uFR_Series_NFC_reader_API.pdf). For quick insight and functions' prototypes, check **/include/ufCoder.h** header file. + +### Prerequisites + +[**uFR**](https://webshop.d-logic.com/products/nfc-rfid-reader-writer/ufr-series-dev-tools-with-sdk.html) or [**uFR Zero**](https://webshop.d-logic.com/products/nfc-rfid-reader-writer/ufr-zero-series.html) Series reader. + +## License + +See the [uFR_library_license.md](/license/uFR_library_license.md) file for details + +## Acknowledgments + +* Libraries are specific to mentioned hardware ONLY and some other hardware might have different approach, please bear that in mind. + + +## Changelog + +## [Version 6.0.21] - 2025-06-18 + +### General Changes + +- X.509 ECC curve domain params feature for MRTD SOD verification. +- New MRTD feature: extract signing certificate from the SOD - **MRTD_SOD_CertToHeap()** +- Document validation implemented for the **MRTD_ReadDocumentData()** function + +## [Version 6.0.20] - 2025-06-13 +**Bug fix** +- MultiReader API: **ReaderList_*()** crash on Windows patched. + +## [Version 6.0.19] - 2025-06-11 +## Diagnostic +** Reader lock status ** +- GetReaderLockStatus(uint8_t *lock_status); + +## [Version 6.0.18] - 2025-05-27 +### Diagnostic +** I2C devices at the reader ** +- GetI2cDevicesStatus(uint8_t *dev_num, uint32_t *dev_bits): Function gets number and types of the installed I2C devices at the reader + +## [Version 6.0.17] - 2025-05-14 +### General Changes + **Bug fix** +- Async API: **Start/StopAsyncSession()** thread termination bug on Windows patched. + +## [Version 6.0.16] - 2025-05-07 +### General Changes +- **API Updates:** +- Async API: **Start/StopAsyncSession()** function calls updated & minor bugs fixed. +### Platform-Specific Changes +#### Android +- StartAsyncSession(): Support added for usage on Android via cable connection to uFR Series reader (OTG) +- StopAsyncSession(): Support added for usage on Android via cable connection to uFR Series reader (OTG) + +### Deprecations +- uFCoder library distribution for `linux/arm-el` and `linux/static-armel` will no longer be receiving regular updates from **v6.0.16** onward as it considered `Deprecated`. +## [Version 6.0.15] - 2025-05-06 + +### ISO15693 card support +** ISO15693 cards lock block implementation ** + +- UFR_STATUS DL_API iso15693_lock_block_no_auth(uint8_t lock_block_address); +- UFR_STATUS DL_API icode_lock_block_PK(IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); //if Protect Page enabled provided passwords +- UFR_STATUS DL_API icode_lock_block(uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); //if Protect Page enabled reader's EEPROM passwords + +** ISO15693 get multiply block security status ** + +- UFR_STATUS DL_API iso15693_get_multiply_block_security_status(uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + +### [Version 6.0.14] - 2025-04-25 + +### General Changes + + **Bug fix** + +- ReaderOpenEx() - Internal call functionality bug fixed. +- APDUPlainTransceive() - LE field parsing fixup for extended APDU commands. + +### [Version 6.0.13] - 2025-04-17 + +### ISO15693 cards support +** NXP ICODE cards passwords manipulation ** + +- UFR_STATUS DL_API icode_write_password_PK(uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); //provided passwords + +- UFR_STATUS DL_API icode_write_password(uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); //reader's EEPROM passwords + +** NXP ICODE SLIX-S, ICODE SLIX2, ICODE 3 protect page support ** + +- UFR_STATUS DL_API icode_protect_page_PK(IN uint8_t *read_password, IN uint8_t *write_password, + +uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); //provided passwords + +- UFR_STATUS DL_API icode_protect_page(uint8_t read_pass_index, uint8_t write_pass_index, + +uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); //reader's EEPROM passwords + +### [Version 6.0.12] - 2025-04-11 + +### General Changes + +**Bug fix** + +- MRTDParseDG1ToHeap() data trimming bug fixed with TD1 format; +- MRTD_ReadDocumentData() minor JSON format fixup. \ No newline at end of file diff --git a/ufr-lib/android/uFCoder.aar b/ufr-lib/android/uFCoder.aar new file mode 100644 index 0000000..93509a9 Binary files /dev/null and b/ufr-lib/android/uFCoder.aar differ diff --git a/ufr-lib/android_nexgo/uFCoder.aar b/ufr-lib/android_nexgo/uFCoder.aar new file mode 100644 index 0000000..327860b Binary files /dev/null and b/ufr-lib/android_nexgo/uFCoder.aar differ diff --git a/ufr-lib/android_sunmi/uFCoder.aar b/ufr-lib/android_sunmi/uFCoder.aar new file mode 100644 index 0000000..f47370d Binary files /dev/null and b/ufr-lib/android_sunmi/uFCoder.aar differ diff --git a/ufr-lib/arduino_ufr/Packet.cpp b/ufr-lib/arduino_ufr/Packet.cpp new file mode 100644 index 0000000..cc48dbf --- /dev/null +++ b/ufr-lib/arduino_ufr/Packet.cpp @@ -0,0 +1,102 @@ +#include "uFR.h" +#ifdef ESP32 +HardwareSerial* uFR::Packet::serial; +#else +SoftwareSerial* uFR::Packet::serial; +#endif + +uFR::CommonPacket::CommonPacket(PacketType type, uint8_t command) { + data = new uint8_t[PACKET_LENGTH]; + errorCode = read(data); + if (errorCode == 0) errorCode = validate(data, type, command); +} +uFR::CommonPacket::~CommonPacket() { + delete[] data; +} + +uFR::EXTPacket::EXTPacket(uint8_t length) { + data = new uint8_t[length]; + errorCode = read(data, length); +} +uFR::EXTPacket::~EXTPacket() { + delete[] data; +} + +uint8_t uFR::Packet::checksum(uint8_t *packet, uint8_t size) { + uint8_t result = packet[0]; + // XOR size bytes + for (uint8_t i = 1; i < size; i++) + result ^= packet[i]; + return result + 0x07; +} + +uint8_t uFR::CommonPacket::validate(uint8_t packet[PACKET_LENGTH], PacketType type, uint8_t command) { + if (checksum(packet) != packet[CHKSUM_BYTE]) return CHKSUM_ERROR_RESPONSE; + if (packet[HEADER_BYTE] == ERR_HEADER) { + if (packet[TRAILER_BYTE] == ERR_TRAILER) return packet[CMD_BYTE]; + return COMMUNICATION_ERROR; + } + if (packet[HEADER_BYTE] != type || packet[CMD_BYTE] != command) return COMMUNICATION_ERROR; + switch (type) { + case PACKET_ACK: + if (packet[TRAILER_BYTE] != ACK_TRAILER) return COMMUNICATION_ERROR; + break; + case PACKET_RSP: + if (packet[TRAILER_BYTE] != RESPONSE_TRAILER) return COMMUNICATION_ERROR; + break; + default: + return COMMUNICATION_ERROR; + } + return 0; +} + +uint8_t uFR::CommonPacket::read(uint8_t response[PACKET_LENGTH]) { + unsigned long time = millis(); + uint8_t incoming = 0; + // Read bytes until header found + while(incoming != ACK_HEADER && incoming != ERR_HEADER && incoming != RESPONSE_HEADER) { + if((unsigned long)(millis() - time) > TIMEOUT_MS) return COMMUNICATION_TIMEOUT; + if (serial->available() > 0) incoming = serial->read(); + } + // Read remaining bytes (PACKET_LENGTH - 1) + while (serial->available() < 6) + if ((unsigned long)(millis() - time) > TIMEOUT_MS) return COMMUNICATION_TIMEOUT; + + // Store bytes + response[0] = incoming; + for (uint8_t i = 1; i < PACKET_LENGTH; i++) + response[i] = serial->read(); + + return 0; +} + +uint8_t uFR::EXTPacket::read(uint8_t *response, uint8_t length) { + unsigned long time = millis(); + uint8_t i = 0; + int b; + // Read length bytes + while (i < length) { + if ((unsigned long)(millis() - time) > TIMEOUT_MS) return COMMUNICATION_TIMEOUT_EXT; + b = serial->read(); + if(b != -1) { + response[i] = b; + i++; + } + } + // Read and check checksum byte (length + 1) + while (serial->available() < 1) + if ((unsigned long)(millis() - time) > TIMEOUT_MS) return COMMUNICATION_TIMEOUT_EXT; + if (serial->read() != checksum(response, length)) return CHKSUM_ERROR_EXT; + + return 0; +} + +void uFR::Packet::copyData(uint8_t *array, uint16_t start, uint16_t length) { + for (uint16_t i = 0; i < length; i++) + array[i + start] = data[i]; +} + +void uFR::Packet::copyDataReverse(uint8_t *array, uint16_t start, uint16_t length) { + for (uint16_t i = 0; i < length; i++) + array[i + start] = data[length - i - 1]; +} \ No newline at end of file diff --git a/ufr-lib/arduino_ufr/keywords.txt b/ufr-lib/arduino_ufr/keywords.txt new file mode 100644 index 0000000..5ab05d0 --- /dev/null +++ b/ufr-lib/arduino_ufr/keywords.txt @@ -0,0 +1,30 @@ +####################################### +# Syntax Coloring Map For uFR +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +uFR KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +hardReset KEYWORD2 +setRedLED KEYWORD2 +getReaderType KEYWORD2 +getReaderSerial KEYWORD2 +setReaderKey KEYWORD2 +getUserData KEYWORD2 +setUserData KEYWORD2 +softReset KEYWORD2 +getCardIDSimple KEYWORD2 +getCardID KEYWORD2 +getCardTypeDLogic KEYWORD2 +TypeDLogicToString KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### \ No newline at end of file diff --git a/ufr-lib/arduino_ufr/uFR.cpp b/ufr-lib/arduino_ufr/uFR.cpp new file mode 100644 index 0000000..df54c59 --- /dev/null +++ b/ufr-lib/arduino_ufr/uFR.cpp @@ -0,0 +1,347 @@ +#include "uFR.h" + +#define PROCESS_EXT(length) \ +EXTPacket extPacket(length); \ +if (extPacket.getErrorCode() != 0) return extPacket.getErrorCode() + +#define PROCESS_ACK(command) \ +CommonPacket ackPacket(PACKET_ACK, command); \ +if (ackPacket.getErrorCode() != 0) return ackPacket.getErrorCode() + +#define PROCESS_RSP(command) \ +CommonPacket rspPacket(PACKET_RSP, command); \ +if (rspPacket.getErrorCode() != 0) return rspPacket.getErrorCode() + +#ifdef ESP32 +uFR::uFR(uint8_t uart) : readerSerial(HardwareSerial(uart)) { + setPacketSerial(); +} + +uFR::uFR(uint8_t uart, uint8_t rx_pin, uint8_t tx_pin) : readerSerial(HardwareSerial(uart)) { + esp32_rx_pin = rx_pin; + esp32_tx_pin = tx_pin; + setPacketSerial(); +} + +uFR::uFR(uint8_t uart, uint8_t reset) : readerSerial(HardwareSerial(uart)) { + pinMode(reset, OUTPUT); + digitalWrite(reset, HIGH); + resetPin = reset; + setPacketSerial(); +} + +uFR::uFR(uint8_t uart, uint8_t reset, uint8_t rx_pin, uint8_t tx_pin) : readerSerial(HardwareSerial(uart)) { + pinMode(reset, OUTPUT); + digitalWrite(reset, HIGH); + resetPin = reset; + esp32_rx_pin = rx_pin; + esp32_tx_pin = tx_pin; + setPacketSerial(); +} + +#else + uFR::uFR(uint8_t rx, uint8_t tx) : readerSerial(SoftwareSerial(rx, tx)) { + setPacketSerial(); +} + +uFR::uFR(uint8_t rx, uint8_t tx, uint8_t reset) : readerSerial(SoftwareSerial(rx, tx)) { + pinMode(reset, OUTPUT); + digitalWrite(reset, HIGH); + resetPin = reset; + setPacketSerial(); +} +#endif + +void uFR::setPacketSerial() { + Packet::serial = &readerSerial; +} + +void uFR::begin(unsigned long baud) { + if(resetPin != 0) { + delay(10); + digitalWrite(resetPin, LOW); + } + #ifdef ESP32 + if(esp32_rx_pin != 0 && esp32_tx_pin != 0) { + readerSerial.begin(baud, SERIAL_8N1, esp32_rx_pin, esp32_tx_pin); + } + else + { + readerSerial.begin(baud); + } + #else + readerSerial.begin(baud); + #endif + +} + +void uFR::hardReset() { + if (resetPin != 0) { + digitalWrite(resetPin, HIGH); + delay(10); + digitalWrite(resetPin, LOW); + } +} + +void uFR::flushSerial() { + while (readerSerial.available() > 0) + readerSerial.read(); +} + +void uFR::sendPacketCMD(uint8_t command, uint8_t EXTlength, uint8_t par0, uint8_t par1) { + uint8_t packet[PACKET_LENGTH] = { + CMD_HEADER, + command, + CMD_TRAILER, + EXTlength, + par0, + par1, + Packet::checksum(packet) + }; + readerSerial.write(packet, PACKET_LENGTH); +} + +void uFR::sendPacketEXT(uint8_t *packet, uint8_t length) { + readerSerial.write(packet, length); + readerSerial.write(Packet::checksum(packet, length)); +} + +// ======================================================================================== + +uint8_t uFR::setRedLED(bool state) { + flushSerial(); + sendPacketCMD(RED_LIGHT_CONTROL, 0, state); + PROCESS_RSP(RED_LIGHT_CONTROL); + return 0; +} + +uint8_t uFR::setUserInterfaceSignal(uint8_t light_signal_mode, uint8_t beep_signal_mode) { + flushSerial(); + sendPacketCMD(USER_INTERFACE_SIGNAL, 0, light_signal_mode, beep_signal_mode); + PROCESS_RSP(USER_INTERFACE_SIGNAL); + return 0; +} + +uint8_t uFR::setGreenLightBlinking(bool state) { + flushSerial(); + sendPacketCMD(SET_LED_CONFIG, 0, state); + PROCESS_RSP(SET_LED_CONFIG); + return 0; +} + + + +uint8_t uFR::getReaderType(uint8_t readerType[READER_TYPE_SIZE]) { + flushSerial(); + sendPacketCMD(GET_READER_TYPE); + PROCESS_RSP(GET_READER_TYPE); + PROCESS_EXT(READER_TYPE_SIZE); + extPacket.copyDataReverse(readerType, 0, READER_TYPE_SIZE); + return 0; +} + +uint8_t uFR::getReaderSerial(uint8_t readerSerialNumber[READER_SERIAL_SIZE]) { + flushSerial(); + sendPacketCMD(GET_READER_SERIAL); + PROCESS_RSP(GET_READER_SERIAL); + PROCESS_EXT(READER_SERIAL_SIZE); + extPacket.copyDataReverse(readerSerialNumber, 0, READER_SERIAL_SIZE); + return 0; +} + +uint8_t uFR::setReaderKey(uint8_t key[READER_KEY_SIZE], uint8_t index) { + flushSerial(); + sendPacketCMD(READER_KEY_WRITE, READER_KEY_SIZE + 1, index); + PROCESS_ACK(READER_KEY_WRITE); + sendPacketEXT(key, READER_KEY_SIZE); + PROCESS_RSP(READER_KEY_WRITE); + return 0; +} + +uint8_t uFR::getUserData(uint8_t data[USER_DATA_SIZE]) { + flushSerial(); + sendPacketCMD(USER_DATA_READ); + PROCESS_RSP(USER_DATA_READ); + PROCESS_EXT(USER_DATA_SIZE); + extPacket.copyData(data, 0, USER_DATA_SIZE); + return 0; +} + +uint8_t uFR::setUserData(uint8_t data[USER_DATA_SIZE]) { + flushSerial(); + sendPacketCMD(USER_DATA_WRITE, USER_DATA_SIZE + 1); + PROCESS_ACK(USER_DATA_WRITE); + sendPacketEXT(data, USER_DATA_SIZE); + PROCESS_RSP(USER_DATA_WRITE); + return 0; +} + +uint8_t uFR::softReset() { + flushSerial(); + sendPacketCMD(SELF_RESET); + PROCESS_RSP(SELF_RESET); + return 0; +} + +uint8_t uFR::getCardIDSimple(uint8_t cardID[CARD_ID_SIZE], uint8_t *cardType) { + flushSerial(); + sendPacketCMD(GET_CARD_ID); + PROCESS_RSP(GET_CARD_ID); + PROCESS_EXT(CARD_ID_SIZE); + extPacket.copyDataReverse(cardID, 0, CARD_ID_SIZE); + if (cardType) *cardType = rspPacket[PAR0_BYTE]; + return 0; +} + +uint8_t uFR::getCardID(uint8_t cardID[CARD_ID_EX_SIZE], uint8_t *length, uint8_t *cardType) { + flushSerial(); + sendPacketCMD(GET_CARD_ID_EX); + PROCESS_RSP(GET_CARD_ID_EX); + PROCESS_EXT(CARD_ID_EX_SIZE); + //extPacket.copyDataReverse(cardID, 0, rspPacket[PAR1_BYTE]); + //extPacket.copyData is used to make the order of bytes of cardID as on the card + extPacket.copyData(cardID, 0, rspPacket[PAR1_BYTE]); + if (cardType) *cardType = rspPacket[PAR0_BYTE]; + if (length) *length = rspPacket[PAR1_BYTE]; + return 0; +} + +uint8_t uFR::getDesfireUID(uint8_t cardID[CARD_ID_EX_SIZE], uint8_t *length, uint8_t InternalAESKeyIndexReader, uint32_t AID, uint8_t key_number_in_application) { + uint8_t desfire_uid_size = 7; //as I can see in protocol, there are no length definitions. UID is always 7B. + *length = desfire_uid_size; + uint8_t data_to_send[22]; + memset(data_to_send, 0, 22); + data_to_send[0]=1; + data_to_send[1]=InternalAESKeyIndexReader; + data_to_send[18] = *((uint8_t *)&AID); + data_to_send[19] = *((uint8_t *)&AID+1); + data_to_send[20] = *((uint8_t *)&AID+2); + data_to_send[21]= key_number_in_application; + +/* + Serial.print("data_to_send = "); + for(int i;i<22;i++) + { + Serial.print(data_to_send[i], HEX); + Serial.print(" "); + } + Serial.print("\n"); +*/ + + flushSerial(); + sendPacketCMD(GET_DESFIRE_UID, 23); + PROCESS_ACK(GET_DESFIRE_UID); + sendPacketEXT(data_to_send, 22); + PROCESS_RSP(GET_DESFIRE_UID); +/* + Serial.print("RSP:"); + for(int i;i<7;++i) + { + Serial.print(rspPacket[i], HEX); + Serial.print(" "); + } + Serial.print("\n"); + +*/ + if(rspPacket[3]!=12) + { + return PARAMETERS_ERROR; + } + PROCESS_EXT(11); + extPacket.copyData(cardID, 0, desfire_uid_size); + return 0; +} + +uint8_t uFR::getDesfireUIDPK(uint8_t cardID[CARD_ID_EX_SIZE], uint8_t *length, uint8_t *AESKey, uint32_t AID, uint8_t key_number_in_application) { + uint8_t desfire_uid_size = 7; //as I can see in protocol, there are no length definitions. UID is always 7B. + *length = desfire_uid_size; + uint8_t data_to_send[22]; + memset(data_to_send, 0, 22); + data_to_send[0]=0; + data_to_send[1]=0; + memcpy(&data_to_send[2], AESKey, 16); + data_to_send[18] = *((uint8_t *)&AID); + data_to_send[19] = *((uint8_t *)&AID+1); + data_to_send[20] = *((uint8_t *)&AID+2); + data_to_send[21]= key_number_in_application; + +/* + Serial.print("data_to_send = "); + for(int i;i<22;i++) + { + Serial.print(data_to_send[i], HEX); + Serial.print(" "); + } + Serial.print("\n"); +*/ + + flushSerial(); + sendPacketCMD(GET_DESFIRE_UID, 23); + PROCESS_ACK(GET_DESFIRE_UID); + sendPacketEXT(data_to_send, 22); + PROCESS_RSP(GET_DESFIRE_UID); +/* + Serial.print("RSP:"); + for(int i;i<7;++i) + { + Serial.print(rspPacket[i], HEX); + Serial.print(" "); + } + Serial.print("\n"); + +*/ + if(rspPacket[3]!=12) + { + return PARAMETERS_ERROR; + } + PROCESS_EXT(11); + extPacket.copyData(cardID, 0, desfire_uid_size); + return 0; +} + +uint8_t uFR::getCardTypeDLogic(uint8_t *cardType) { + flushSerial(); + sendPacketCMD(GET_DLOGIC_CARD_TYPE); + PROCESS_RSP(GET_DLOGIC_CARD_TYPE); + *cardType = rspPacket[PAR0_BYTE]; + return 0; +} + +// ======================================================================================== + +// Needs beautifying +const char * TypeDLogicToString(uint8_t type) { + switch (type) { + case 0x00: return "TAG_UNKNOWN"; break; + case 0x01: return "DL_MIFARE_ULTRALIGHT"; break; + case 0x02: return "DL_MIFARE_ULTRALIGHT_EV1_11"; break; + case 0x03: return "DL_MIFARE_ULTRALIGHT_EV1_21"; break; + case 0x04: return "DL_MIFARE_ULTRALIGHT_C"; break; + case 0x05: return "DL_NTAG_203"; break; + case 0x06: return "DL_NTAG_210"; break; + case 0x07: return "DL_NTAG_212"; break; + case 0x08: return "DL_NTAG_213"; break; + case 0x09: return "DL_NTAG_215"; break; + case 0x0A: return "DL_NTAG_216"; break; + case 0x0B: return "DL_MIKRON_MIK640D"; break; + case 0x0C: return "NFC_T2T_GENERIC"; break; + case 0x20: return "DL_MIFARE_MINI"; break; + case 0x21: return "DL_MIFARE_CLASSIC_1K"; break; + case 0x22: return "DL_MIFARE_CLASSIC_4K"; break; + case 0x23: return "DL_MIFARE_PLUS_S_2K"; break; + case 0x24: return "DL_MIFARE_PLUS_S_4K"; break; + case 0x25: return "DL_MIFARE_PLUS_X_2K"; break; + case 0x26: return "DL_MIFARE_PLUS_X_4K"; break; + case 0x27: return "DL_MIFARE_DESFIRE"; break; + case 0x28: return "DL_MIFARE_DESFIRE_EV1_2K"; break; + case 0x29: return "DL_MIFARE_DESFIRE_EV1_4K"; break; + case 0x2A: return "DL_MIFARE_DESFIRE_EV1_8K"; break; + case 0x2B: return "DL_MIFARE_DESFIRE_EV2_2K"; break; + case 0x2C: return "DL_MIFARE_DESFIRE_EV2_4K"; break; + case 0x2D: return "DL_MIFARE_DESFIRE_EV2_8K"; break; + case 0x40: return "DL_GENERIC_ISO14443_4"; break; + case 0x41: return "DL_GENERIC_ISO14443_TYPE_B"; break; + case 0x80: return "DL_IMEI_UID"; break; + default: return "TYPE_ERROR"; + } +} diff --git a/ufr-lib/arduino_ufr/uFR.h b/ufr-lib/arduino_ufr/uFR.h new file mode 100644 index 0000000..d01f90b --- /dev/null +++ b/ufr-lib/arduino_ufr/uFR.h @@ -0,0 +1,284 @@ +/// Digital Logic uFR NFC card reader library for Arduino +/// +/// Based on IS21 DLogic serial communication protocol +/// +/// Version: 1.0.0 +/// 2018 Marko Djordjevic + + +#include +#ifdef ESP32 +#include +#else +#include +#endif + +#define TIMEOUT_MS 100 // Debugging + +// Communication constants +#define MAX_PACKET_LENGTH 64 +#define HEADER_BYTE 0 +#define CMD_BYTE 1 +#define TRAILER_BYTE 2 +#define EXT_LENGTH_BYTE 3 +#define PAR0_BYTE 4 +#define PAR1_BYTE 5 +#define CHKSUM_BYTE 6 +#define PACKET_LENGTH 7 +#define CMD_HEADER 0x55 +#define ACK_HEADER 0xAC +#define RESPONSE_HEADER 0xDE +#define ERR_HEADER 0xEC +#define CMD_TRAILER 0xAA +#define ACK_TRAILER 0xCA +#define RESPONSE_TRAILER 0xED +#define ERR_TRAILER 0xCE + +// CMD codes +#define GET_READER_TYPE 0x10 +#define GET_READER_SERIAL 0x11 +#define READER_KEY_WRITE 0x12 +#define GET_CARD_ID 0x13 +#define LINEAR_READ 0x14 +#define LINEAR_WRITE 0x15 +#define BLOCK_READ 0x16 +#define BLOCK_WRITE 0x17 +#define BLOCK_IN_SECTOR_READ 0x18 +#define BLOCK_IN_SECTOR_WRITE 0x19 +#define SECTOR_TRAILER_WRITE 0X1A +#define USER_DATA_READ 0x1B +#define USER_DATA_WRITE 0x1C +#define VALUE_BLOCK_READ 0x1D +#define VALUE_BLOCK_WRITE 0x1E +#define VALUE_BLOCK_IN_SECTOR_READ 0x1F +#define VALUE_BLOCK_IN_SECTOR_WRITE 0x20 +#define VALUE_BLOCK_INC 0x21 +#define VALUE_BLOCK_DEC 0x22 +#define VALUE_BLOCK_IN_SECTOR_INC 0x23 +#define VALUE_BLOCK_IN_SECTOR_DEC 0x24 +#define LINEAR_FORMAT_CARD 0x25 +#define USER_INTERFACE_SIGNAL 0x26 +#define GET_CARD_ID_EX 0x2C +#define SECTOR_TRAILER_WRITE_UNSAFE 0x2F +#define SELF_RESET 0x30 +#define GET_DLOGIC_CARD_TYPE 0x3C +#define SET_CARD_ID_SEND_CONF 0x3D +#define GET_CARD_ID_SEND_CONF 0x3E +#define SET_LED_CONFIG 0x6E +#define SET_UART_SPEED 0x70 +#define RED_LIGHT_CONTROL 0x71 +#define GET_DESFIRE_UID 0x80 + +// ERR codes +#define OK 0x00 +#define COMMUNICATION_ERROR 0x01 +#define COMMUNICATION_TIMEOUT 0x50 +#define COMMUNICATION_TIMEOUT_EXT 0x51 +#define CHKSUM_ERROR 0x02 +#define CHKSUM_ERROR_RESPONSE 0x52 +#define CHKSUM_ERROR_EXT 0x53 +#define READING_ERROR 0x03 +#define WRITING_ERROR 0x04 +#define BUFFER_OVERFLOW 0x05 +#define MAX_ADDRESS_EXCEEDED 0x06 +#define MAX_KEY_INDEX_EXCEEDED 0x07 +#define NO_CARD 0x08 +#define COMMAND_NOT_SUPPORTED 0x09 +#define FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER 0x0A +#define ADDRESSED_BLOCK_IS_NOT_SECTOR_TRAILER 0x0B +#define WRONG_ADDRESS_MODE 0x0C +#define WRONG_ACCESS_BITS_VALUES 0x0D +#define AUTH_ERROR 0x0E +#define PARAMETERS_ERROR 0x0F +#define WRITE_VERIFICATION_ERROR 0x70 +#define BUFFER_SIZE_EXCEEDED 0x71 +#define VALUE_BLOCK_INVALID 0x72 +#define VALUE_BLOCK_ADDR_INVALID 0x73 +#define VALUE_BLOCK_MANIPULATION_ERROR 0x74 + + + +// MIFARE CLASSIC type id's: +#define MIFARE_CLASSIC_1k 0x08 +#define MF1ICS50 0x08 +#define SLE66R35 0x88 // Infineon = Mifare Classic 1k +#define MIFARE_CLASSIC_4k 0x18 +#define MF1ICS70 0x18 +#define MIFARE_CLASSIC_MINI 0x09 +#define MF1ICS20 0x09 + +// DLOGIC CARD TYPE +#define TAG_UNKNOWN 0 +#define DL_MIFARE_ULTRALIGHT 0x01 +#define DL_MIFARE_ULTRALIGHT_EV1_11 0x02 +#define DL_MIFARE_ULTRALIGHT_EV1_21 0x03 +#define DL_MIFARE_ULTRALIGHT_C 0x04 +#define DL_NTAG_203 0x05 +#define DL_NTAG_210 0x06 +#define DL_NTAG_212 0x07 +#define DL_NTAG_213 0x08 +#define DL_NTAG_215 0x09 +#define DL_NTAG_216 0x0A +#define DL_MIKRON_MIK640D 0x0B +#define NFC_T2T_GENERIC 0x0C +#define DL_MIFARE_MINI 0x20 +#define DL_MIFARE_CLASSIC_1K 0x21 +#define DL_MIFARE_CLASSIC_4K 0x22 +#define DL_MIFARE_PLUS_S_2K 0x23 +#define DL_MIFARE_PLUS_S_4K 0x24 +#define DL_MIFARE_PLUS_X_2K 0x25 +#define DL_MIFARE_PLUS_X_4K 0x26 +#define DL_MIFARE_DESFIRE 0x27 +#define DL_MIFARE_DESFIRE_EV1_2K 0x28 +#define DL_MIFARE_DESFIRE_EV1_4K 0x29 +#define DL_MIFARE_DESFIRE_EV1_8K 0x2A +#define DL_MIFARE_DESFIRE_EV2_2K 0x2B +#define DL_MIFARE_DESFIRE_EV2_4K 0x2C +#define DL_MIFARE_DESFIRE_EV2_8K 0x2D +//#define DL_UNKNOWN_ISO_14443_4 0x40 +#define DL_GENERIC_ISO14443_4 0x40 +#define DL_GENERIC_ISO14443_TYPE_B 0x41 +#define DL_IMEI_UID 0x80 + +// Function return sizes in bytes +#define READER_TYPE_SIZE 4 +#define READER_SERIAL_SIZE 4 +#define READER_KEY_SIZE 6 +#define USER_DATA_SIZE 16 +#define CARD_ID_SIZE 4 +#define CARD_ID_EX_SIZE 10 + + +// USER_INTERFACE_SIGNAL + +#define NONE 0 +#define LONG_GREEN 1 +#define SHORT_BEEP 1 +#define LONG_RED 2 +#define LONG_BEEP 2 +#define ALTERNATNG_LIGHT 3 +#define DOUBLE_SHORT_BEEP 3 +#define FLASH_LIGHT 4 +#define TRIPLE_SHORT_BEEP 4 +#define TRIPLET_MELODY 5 + +enum PacketType { + PACKET_ACK = ACK_HEADER, + PACKET_ERR = ERR_HEADER, + PACKET_RSP = RESPONSE_HEADER +}; + +class uFR { + public: + #ifdef ESP32 + uFR(uint8_t uart); + uFR(uint8_t uart, uint8_t reset); + uFR(uint8_t uart, uint8_t rx_pin, uint8_t tx_pin); + uFR(uint8_t uart, uint8_t reset, uint8_t rx_pin, uint8_t tx_pin); + #else + uFR(uint8_t rx, uint8_t tx); + uFR(uint8_t rx, uint8_t tx, uint8_t reset); + #endif + + + void begin(unsigned long baud = 115200); // Resets the reader if reset pin is used; make sure to add delay! + inline void end() { readerSerial.end(); } + // Resets through reset pin (if declared) + void hardReset(); // Make sure to add delay! + + // All following functions return error codes after execution + // If 0 is returned, the function has executed normally + + // Controls the reader's red LED. Green LED stops flashing while red LED is on + uint8_t setRedLED(bool state); + + uint8_t setUserInterfaceSignal(uint8_t light_signal_mode = 0, uint8_t beep_signal_mode = 0); + + uint8_t setGreenLightBlinking(bool state); + + uint8_t getReaderType(uint8_t readerType[READER_TYPE_SIZE]); + + uint8_t getReaderSerial(uint8_t readerSerialNumber[READER_SERIAL_SIZE]); + + // Writes MIFARE key into reader EEPROM, at index location (0-31) + uint8_t setReaderKey(uint8_t key[READER_KEY_SIZE], uint8_t index); + + // User data are 16 bytes form internal EEPROM + uint8_t getUserData(uint8_t data[USER_DATA_SIZE]); + + uint8_t setUserData(uint8_t data[USER_DATA_SIZE]); + + // Sends reset command (add 2s delay!) + uint8_t softReset(); + + // Gets card UID that is present in reader's RF field. Obsolete + uint8_t getCardIDSimple(uint8_t cardID[CARD_ID_SIZE], uint8_t *cardType = nullptr); + + // Length - UID size in bytes (4, 7 or 10) + uint8_t getCardID(uint8_t cardID[CARD_ID_EX_SIZE], uint8_t *length = nullptr, uint8_t *cardType = nullptr); + + // Gets Desfire UID + uint8_t getDesfireUID(uint8_t cardID[CARD_ID_EX_SIZE], uint8_t *length = nullptr, uint8_t InternalAESKeyIndexReader = 0, uint32_t AID = 0, uint8_t key_number_in_application = 0); + + // Gets Desfire UID with provided AES key + uint8_t getDesfireUIDPK(uint8_t cardID[CARD_ID_EX_SIZE], uint8_t *length, uint8_t *AESKey = nullptr, uint32_t AID = 0, uint8_t key_number_in_application = 0); + + // Card type per DLogic enumeration + uint8_t getCardTypeDLogic(uint8_t *cardType); + + // ------------------------------------------------------------- + + static const char * TypeDLogicToString(uint8_t type); + + private: + #ifdef ESP32 + HardwareSerial readerSerial; + uint8_t esp32_rx_pin = 0; + uint8_t esp32_tx_pin = 0; + #else + SoftwareSerial readerSerial; + #endif + uint8_t resetPin = 0; + + void flushSerial(); // Flush serial input buffer + + void sendPacketCMD(uint8_t command, uint8_t EXTlength = 0, uint8_t par0 = 0, uint8_t par1 = 0); + void sendPacketEXT(uint8_t *packet, uint8_t length); + + void setPacketSerial (); // Sets static protected packet serial pointer + + class Packet { + public: + static uint8_t checksum(uint8_t *packet, uint8_t size = PACKET_LENGTH - 1); + inline uint8_t getErrorCode() { return errorCode; } + inline uint8_t getLength() { return length; } + void copyData(uint8_t *array, uint16_t start, uint16_t length); + void copyDataReverse(uint8_t *array, uint16_t start, uint16_t length); + inline uint8_t operator[] (uint8_t i) { return data[i]; } + friend void uFR::setPacketSerial (); + protected: + #ifdef ESP32 + static HardwareSerial *serial; + #else + static SoftwareSerial *serial; + #endif + uint8_t errorCode = 0; + uint8_t length = PACKET_LENGTH; + uint8_t *data; + }; + class CommonPacket : public Packet { + // Returns error code + uint8_t read(uint8_t response[PACKET_LENGTH]); + uint8_t validate(uint8_t packet[PACKET_LENGTH], PacketType type, uint8_t command); + public: + CommonPacket(PacketType type, uint8_t command); + ~CommonPacket(); + }; + class EXTPacket : public Packet { + // Returns error code, reads AND validates + uint8_t read(uint8_t *response, uint8_t length); + public: + EXTPacket(uint8_t length); + ~EXTPacket(); + }; +}; diff --git a/ufr-lib/esp32/CMakeLists.txt b/ufr-lib/esp32/CMakeLists.txt new file mode 100644 index 0000000..3ad626c --- /dev/null +++ b/ufr-lib/esp32/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register(INCLUDE_DIRS "include") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pragmas -Wno-unused-variable -Wno-maybe-uninitialized -Wno-implicit-function-declaration -mlongcalls -Wno-type-limits -Wno-implicit-fallthrough -Wno-format-overflow -Wno-comment -Wno-format-truncation -Wno-array-bounds -DDEBUG_PRINT=0 -D_NO_FTDI=1 -DESP_PLATFORM=1") +target_link_libraries(${COMPONENT_LIB} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/lib") +target_link_libraries(${COMPONENT_LIB} INTERFACE ufcoder) \ No newline at end of file diff --git a/ufr-lib/esp32/component.mk b/ufr-lib/esp32/component.mk new file mode 100644 index 0000000..7e1ff9f --- /dev/null +++ b/ufr-lib/esp32/component.mk @@ -0,0 +1,4 @@ +COMPONENT_ADD_INCLUDEDIRS := include +CFLAGS := -Wno-pragmas -Wno-unused-variable -Wno-maybe-uninitialized -Wno-implicit-function-declaration -mlongcalls -DDEBUG_PRINT=0 -D_NO_FTDI=1 + +COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/lib/libufcoder.a \ No newline at end of file diff --git a/ufr-lib/esp32/include/uFCoder.h b/ufr-lib/esp32/include/uFCoder.h new file mode 100644 index 0000000..5132a75 --- /dev/null +++ b/ufr-lib/esp32/include/uFCoder.h @@ -0,0 +1,49368 @@ +/* + * uFCoder.h + * + * library version: 6.0.6 + * + * Created on: 2009-01-14 + * Last edited: 2024-12-18 + * + * Author: D-Logic + */ +#ifndef uFCoder_H_ +#define uFCoder_H_ + +#include +#include +#include + +#define IN // array that you pass to function +#define OUT // array that you receive from function +#define VAR // first element of array that you receive from function (single variable) + +//////////////////////////////////////////////////////////////////// +/** + * Type for representing null terminated char array ( aka C-String ) + * Array is always one byte longer ( for null character ) then string + * Memory space for array must be allocated before use. + */ +typedef const char *c_string; +//////////////////////////////////////////////////////////////////// + +#ifdef _WIN32 +// WINDOWS +#if defined(DL_CREATE_STATIC_LIB) || defined(DL_USE_STATIC_LIB) +#define DL_API +#else +#ifndef DL_uFC_EXPORTS +#ifdef _WIN_IOT +#define DL_API __declspec(dllimport) // Win IoT +#else +#define DL_API /*__declspec(dllimport) */ __stdcall // STDCALL - GCC - .NET +#endif // _WIN_IOT +#else +#define DL_API __declspec(dllexport) __stdcall +#endif // DL_uFC_EXPORTS +#endif // DL_CREATE_STATIC_LIB +#else +// Linux & MAC OS +#define DL_API +#endif // _WIN32 + +#if defined(DL_uFC_EXPORTS) || defined(DL_CREATE_STATIC_LIB) || defined(__ANDROID__) || defined(ESP_PLATFORM) || defined(IOS_PLATFORM) +typedef struct S_UFR_HANDLE *UFR_HANDLE; +#else +typedef void *UFR_HANDLE; +#endif + +// MIFARE CLASSIC type id's: +#define MIFARE_CLASSIC_1k 0x08 +#define MF1ICS50 0x08 +#define SLE66R35 0x88 // Infineon = Mifare Classic 1k +#define MIFARE_CLASSIC_4k 0x18 +#define MF1ICS70 0x18 +#define MIFARE_CLASSIC_MINI 0x09 +#define MF1ICS20 0x09 + +// DLOGIC CARD TYPE +#define TAG_UNKNOWN 0 +#define DL_MIFARE_ULTRALIGHT 0x01 +#define DL_MIFARE_ULTRALIGHT_EV1_11 0x02 +#define DL_MIFARE_ULTRALIGHT_EV1_21 0x03 +#define DL_MIFARE_ULTRALIGHT_C 0x04 +#define DL_NTAG_203 0x05 +#define DL_NTAG_210 0x06 +#define DL_NTAG_212 0x07 +#define DL_NTAG_213 0x08 +#define DL_NTAG_215 0x09 +#define DL_NTAG_216 0x0A +#define DL_MIKRON_MIK640D 0x0B +#define NFC_T2T_GENERIC 0x0C +#define DL_NT3H_1101 0x0D +#define DL_NT3H_1201 0x0E +#define DL_NT3H_2111 0x0F +#define DL_NT3H_2211 0x10 +#define DL_NTAG_413_DNA 0x11 +#define DL_NTAG_424_DNA 0x12 +#define DL_NTAG_424_DNA_TT 0x13 +#define DL_NTAG_210U 0x14 +#define DL_NTAG_213_TT 0x15 + +#define DL_MIFARE_CLASSIC_2K 0x19 +#define DL_MIFARE_MINI 0x20 +#define DL_MIFARE_CLASSIC_1K 0x21 +#define DL_MIFARE_CLASSIC_4K 0x22 +#define DL_MIFARE_PLUS_S_2K_SL0 0x23 +#define DL_MIFARE_PLUS_S_4K_SL0 0x24 +#define DL_MIFARE_PLUS_X_2K_SL0 0x25 +#define DL_MIFARE_PLUS_X_4K_SL0 0x26 +#define DL_MIFARE_DESFIRE 0x27 +#define DL_MIFARE_DESFIRE_EV1_2K 0x28 +#define DL_MIFARE_DESFIRE_EV1_4K 0x29 +#define DL_MIFARE_DESFIRE_EV1_8K 0x2A +#define DL_MIFARE_DESFIRE_EV2_2K 0x2B +#define DL_MIFARE_DESFIRE_EV2_4K 0x2C +#define DL_MIFARE_DESFIRE_EV2_8K 0x2D +#define DL_MIFARE_PLUS_S_2K_SL1 0x2E +#define DL_MIFARE_PLUS_X_2K_SL1 0x2F +#define DL_MIFARE_PLUS_EV1_2K_SL1 0x30 +#define DL_MIFARE_PLUS_X_2K_SL2 0x31 +#define DL_MIFARE_PLUS_S_2K_SL3 0x32 +#define DL_MIFARE_PLUS_X_2K_SL3 0x33 +#define DL_MIFARE_PLUS_EV1_2K_SL3 0x34 +#define DL_MIFARE_PLUS_S_4K_SL1 0x35 +#define DL_MIFARE_PLUS_X_4K_SL1 0x36 +#define DL_MIFARE_PLUS_EV1_4K_SL1 0x37 +#define DL_MIFARE_PLUS_X_4K_SL2 0x38 +#define DL_MIFARE_PLUS_S_4K_SL3 0x39 +#define DL_MIFARE_PLUS_X_4K_SL3 0x3A +#define DL_MIFARE_PLUS_EV1_4K_SL3 0x3B +#define DL_MIFARE_PLUS_SE_SL0 0x3C +#define DL_MIFARE_PLUS_SE_SL1 0x3D +#define DL_MIFARE_PLUS_SE_SL3 0x3E +#define DL_MIFARE_DESFIRE_LIGHT 0x3F + +#define DL_UNKNOWN_ISO_14443_4 0x40 +#define DL_GENERIC_ISO14443_4 0x40 +#define DL_GENERIC_ISO14443_4_TYPE_B 0x41 +#define DL_GENERIC_ISO14443_3_TYPE_B 0x42 +#define DL_MIFARE_PLUS_EV1_2K_SL0 0x43 +#define DL_MIFARE_PLUS_EV1_4K_SL0 0x44 +#define DL_MIFARE_DESFIRE_EV3_2K 0x45 +#define DL_MIFARE_DESFIRE_EV3_4K 0x46 +#define DL_MIFARE_DESFIRE_EV3_8K 0x47 + +#define DL_MOBILE_AID 0x60 +#define DL_APPLE_VAS_V1 0x6A +#define DL_APPLE_VAS_V2 0x6B +#define DL_IMEI_UID 0x80 + +// ST Product ID-s: +#define M24SR02 0x82 +#define M24SR02_AUTOMOTIVE 0x8A +#define M24SR04 0x86 +#define M24SR04_AUTOMOTIVE 0x8E +#define M24SR16 0x85 +#define M24SR16_AUTOMOTIVE 0x8D +#define M24SR64 0x84 +#define M24SR64_AUTOMOTIVE 0x8C + +// DLJavaCardTypes: +#define DLSigner81 0xA0 +#define DLSigner22 0xA1 +#define DLSigner30 0xA2 +#define DLSigner10 0xA3 +#define DLSigner145 0xAA + +enum E_CARD_IN_SAM_SLOT +{ + SAM_SLOT_MIFARE_SAM_AV2 = 1, + SAM_SLOT_GENERIC = 4 +}; + +// DLJavaCardSignerAlgorithmTypes: +enum E_SIGNER_CIPHERS +{ + SIG_CIPHER_RSA = 0, + SIG_CIPHER_ECDSA, + + SIG_CIPHER_MAX_SUPPORTED +}; + +enum E_SIGNER_RSA_PADDINGS +{ + PAD_NULL = 0, + PAD_PKCS1_V1_5, + PAD_PKCS1_PSS, + + SIG_PAD_MAX_SUPPORTED +}; +#define PAD_PKCS1 PAD_PKCS1_V1_5 + +enum E_SIGNER_DIGESTS +{ + ALG_NULL = 0, + ALG_SHA, + ALG_SHA_256, + ALG_SHA_384, + ALG_SHA_512, + ALG_SHA_224, + ALG_SHA_512_224, + ALG_SHA_512_256, + + SIG_DIGEST_MAX_SUPPORTED +}; + +enum E_KEY_TYPES +{ + TYPE_RSA_PRIVATE = 0, + TYPE_RSA_CRT_PRIVATE, + TYPE_EC_F2M_PRIVATE, + TYPE_EC_FP_PRIVATE +}; + +enum E_OBJ_TYPES +{ + OBJ_TYPE_RSA_CERT = 0, + OBJ_TYPE_EC_CERT, + OBJ_TYPE_CA_CERT, + + OBJ_TYPES_COUNT +}; + +// JCDL_AIDs +#define DL_RAW_SIZEOF_SZ(x) (sizeof(x) - 1) +#define DL_AID_RID_PLUS "\xF0" "DLogic" +#define DL_SIGNER_PIX "\x00\x01" +#define DL_STORAGE_PIX "\x01\x01" +#define DL_SIGNER_AID DL_AID_RID_PLUS DL_SIGNER_PIX +#define DL_SIGNER_AID_SIZE 9 +#define DL_STORAGE_AID DL_AID_RID_PLUS DL_STORAGE_PIX +#define DL_STORAGE_AID_SIZE 9 + +// Universal JCDL instructions: +#define INS_LOGIN 0x20 +#define INS_GET_PIN_TRIES_REMAINING 0x21 +#define INS_PIN_CHANGE 0x22 +#define INS_PIN_UNBLOCK 0x23 + +// JCDLStorage instructions: +#define INS_PIN_ENABLE 0x24 +#define INS_PIN_DISABLE 0x25 +#define INS_LIST_FILES 0x31 +#define INS_GET_FILE_SIZE 0x32 +#define INS_READ_FILE 0x33 +#define INS_WRITE_FILE 0x34 +#define INS_DELETE_FILE 0x3F + +// JCDLSigner instructions: +#define INS_SET_RSA_PRIKEY 0x51 +#define INS_GEN_RSA_KEY_PAIR 0x52 +#define INS_GET_RSA_PUBKEY_MODULUS 0x53 +#define INS_GET_RSA_PUBKEY_EXPONENT 0x54 +#define INS_DEL_RSA_KEY_PAIR 0x5F +#define INS_SET_EC_PRIKEY 0x61 +#define INS_GEN_EC_KEY_PAIR 0x62 +#define INS_GET_EC_PUBKEY 0x63 +#define INS_GET_EC_FIELD 0x64 +#define INS_GET_EC_AB 0x65 +#define INS_GET_EC_G 0x66 +#define INS_GET_EC_RK_SIZE 0x67 +#define INS_DEL_EC_KEY_PAIR 0x6F +#define INS_GET_SIGNATURE 0x71 +#define INS_PUT_OBJ 0x31 +#define INS_PUT_OBJ_SUBJECT 0x32 +#define INS_INVALIDATE_CERT 0x33 +#define INS_GET_OBJ 0x41 +#define INS_GET_OBJ_ID 0x42 +#define INS_GET_OBJ_SUBJECT 0x43 + +// Universal JCDL constants: +#define PIN_MAX_TRIES 5 +#define PIN_MIN_LENGTH 4 +#define PIN_MAX_LENGTH 8 +#define PUK_MAX_TRIES 10 +#define PUK_LENGTH 8 + +// JCDLSigner constants: +#define JC_APP_MAX_KEY_INDEX ((3) - 1) +#define JC_APP_MAX_CA_CERT_INDEX ((12) - 1) +#define JC_APP_MAX_ID_SIZE 253 +#define JC_APP_MAX_SUBJECT_SIZE 255 +#define JC_APP_MAX_SIGNATURE_LEN 256 +#define JC_APP_MAX_PIN_LENGTH 8 + +// JCDLStorage constants: +#define JC_DL_STORAGE_MAX_FILES 16 +#define JC_DL_STORAGE_MAX_FILE_SIZE (32 * 1024 - 2) // 32KB - 2 byte system reserved + +// MIFARE CLASSIC Authentication Modes: +enum MIFARE_AUTHENTICATION +{ + MIFARE_AUTHENT1A = 0x60, + MIFARE_AUTHENT1B = 0x61, +}; + +// MIFARE PLUS AES Authentication Modes: +enum MIFARE_PLUS_AES_AUTHENTICATION +{ + MIFARE_PLUS_AES_AUTHENT1A = 0x80, + MIFARE_PLUS_AES_AUTHENT1B = 0x81, +}; + +enum MIFARE_PLUS_AES_KEY_TYPE +{ + MIFARE_PLUS_AES_KEY_A = 1, + MIFARE_PLUS_AES_KEY_B = 2, +}; + +// T2T authentication constants: +enum T2T_AUTHENTICATION +{ + T2T_NO_PWD_AUTH = 0, + T2T_RKA_PWD_AUTH = 1, + T2T_PK_PWD_AUTH = 3, + T2T_WITHOUT_PWD_AUTH = 0x60, + T2T_WITH_PWD_AUTH = 0x61, +}; + +// T4T authentication constants +enum T4T_AUTHENTICATION +{ + T4T_WITHOUT_PWD_AUTH = 0x60, + T4T_PK_PWD_AUTH = 0x80, + T4T_RKA_PWD_AUTH = 0x02, +}; + +enum ADDRESS_MODE +{ + ADDRESS_MODE_BLOCK = 0, + ADDRESS_MODE_SECTOR, +}; + +#define MAX_UID_LEN 10 +#define MAX_ATS_LEN 25 +#define ECC_SIG_LEN 32 + +// API Status Codes Type: +typedef enum UFCODER_ERROR_CODES +{ + UFR_OK = 0x00, + UFR_COMMUNICATION_ERROR = 0x01, + UFR_CHKSUM_ERROR = 0x02, + UFR_READING_ERROR = 0x03, + UFR_WRITING_ERROR = 0x04, + UFR_BUFFER_OVERFLOW = 0x05, + UFR_MAX_ADDRESS_EXCEEDED = 0x06, + UFR_MAX_KEY_INDEX_EXCEEDED = 0x07, + UFR_NO_CARD = 0x08, + UFR_COMMAND_NOT_SUPPORTED = 0x09, + UFR_FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER = 0x0A, + UFR_ADDRESSED_BLOCK_IS_NOT_SECTOR_TRAILER = 0x0B, + UFR_WRONG_ADDRESS_MODE = 0x0C, + UFR_WRONG_ACCESS_BITS_VALUES = 0x0D, + UFR_AUTH_ERROR = 0x0E, + UFR_PARAMETERS_ERROR = 0x0F, + UFR_MAX_SIZE_EXCEEDED = 0x10, + UFR_UNSUPPORTED_CARD_TYPE = 0x11, + + UFR_COMMUNICATION_BREAK = 0x50, + UFR_NO_MEMORY_ERROR = 0x51, + UFR_CAN_NOT_OPEN_READER = 0x52, + UFR_READER_NOT_SUPPORTED = 0x53, + UFR_READER_OPENING_ERROR = 0x54, + UFR_READER_PORT_NOT_OPENED = 0x55, + UFR_CANT_CLOSE_READER_PORT = 0x56, + UFR_BLE_INVALID_PAIRING = 0x57, + + UFR_I2C_BUS_ERROR = 0x6A, + UFR_ECC_STORAGE_ERROR = 0x6B, + + UFR_WRITE_VERIFICATION_ERROR = 0x70, + UFR_BUFFER_SIZE_EXCEEDED = 0x71, + UFR_VALUE_BLOCK_INVALID = 0x72, + UFR_VALUE_BLOCK_ADDR_INVALID = 0x73, + UFR_VALUE_BLOCK_MANIPULATION_ERROR = 0x74, + UFR_WRONG_UI_MODE = 0x75, + UFR_KEYS_LOCKED = 0x76, + UFR_KEYS_UNLOCKED = 0x77, + UFR_WRONG_PASSWORD = 0x78, + UFR_CAN_NOT_LOCK_DEVICE = 0x79, + UFR_CAN_NOT_UNLOCK_DEVICE = 0x7A, + UFR_DEVICE_EEPROM_BUSY = 0x7B, + UFR_RTC_SET_ERROR = 0x7C, + + ANTI_COLLISION_DISABLED = 0x7D, + NO_TAGS_ENUMERRATED = 0x7E, + CARD_ALREADY_SELECTED = 0x7F, + + // NDEF error codes + UFR_WRONG_NDEF_CARD_FORMAT = 0x80, + UFR_NDEF_MESSAGE_NOT_FOUND = 0x81, + UFR_NDEF_UNSUPPORTED_CARD_TYPE = 0x82, + UFR_NDEF_CARD_FORMAT_ERROR = 0x83, + UFR_MAD_NOT_ENABLED = 0x84, + UFR_MAD_VERSION_NOT_SUPPORTED = 0x85, + UFR_NDEF_MESSAGE_NOT_COMPATIBLE = 0x86, + + // Tag emulation mode errors: + FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90, + + // FTDI errors: + UFR_FT_STATUS_ERROR_1 = 0xA0, + UFR_FT_STATUS_ERROR_2 = 0xA1, + UFR_FT_STATUS_ERROR_3 = 0xA2, + UFR_FT_STATUS_ERROR_4 = 0xA3, + UFR_FT_STATUS_ERROR_5 = 0xA4, + UFR_FT_STATUS_ERROR_6 = 0xA5, + UFR_FT_STATUS_ERROR_7 = 0xA6, + UFR_FT_STATUS_ERROR_8 = 0xA7, + UFR_FT_STATUS_ERROR_9 = 0xA8, + + // MIFARE PLUS error codes + UFR_MFP_COMMAND_OVERFLOW = 0xB0, + UFR_MFP_INVALID_MAC = 0xB1, + UFR_MFP_INVALID_BLOCK_NR = 0xB2, + UFR_MFP_NOT_EXIST_BLOCK_NR = 0xB3, + UFR_MFP_COND_OF_USE_ERROR = 0xB4, + UFR_MFP_LENGTH_ERROR = 0xB5, + UFR_MFP_GENERAL_MANIP_ERROR = 0xB6, + UFR_MFP_SWITCH_TO_ISO14443_4_ERROR = 0xB7, + UFR_MFP_ILLEGAL_STATUS_CODE = 0xB8, + UFR_MFP_MULTI_BLOCKS_READ = 0xB9, + + // NT4H error codes + NT4H_COMMAND_ABORTED = 0xC0, + NT4H_LENGTH_ERROR = 0xC1, + NT4H_PARAMETER_ERROR = 0xC2, + NT4H_NO_SUCH_KEY = 0xC3, + NT4H_PERMISSION_DENIED = 0xC4, + NT4H_AUTHENTICATION_DELAY = 0xC5, + NT4H_MEMORY_ERROR = 0xC6, + NT4H_INTEGRITY_ERROR = 0xC7, + NT4H_FILE_NOT_FOUND = 0xC8, + NT4H_BOUNDARY_ERROR = 0xC9, + NT4H_INVALID_MAC = 0xCA, + NT4H_NO_CHANGES = 0xCB, + + // multiple units - return from the functions with ReaderList_ prefix in name + UFR_DEVICE_WRONG_HANDLE = 0x100, + UFR_DEVICE_INDEX_OUT_OF_BOUND, + UFR_DEVICE_ALREADY_OPENED, + UFR_DEVICE_ALREADY_CLOSED, + UFR_DEVICE_IS_NOT_CONNECTED, + + // Originality Check Error Codes: + UFR_NOT_NXP_GENUINE = 0x200, + UFR_OPEN_SSL_DYNAMIC_LIB_FAILED, + UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND, + + // DESFIRE Card Status Error Codes: + READER_ERROR = 0xBB7, // 2999 [dec] + NO_CARD_DETECTED = 0xBB8, // 3000 [dec] + CARD_OPERATION_OK = 0xBB9, // 3001 [dec] + WRONG_KEY_TYPE = 0xBBA, // 3002 [dec] + KEY_AUTH_ERROR = 0xBBB, // 3003 [dec] + CARD_CRYPTO_ERROR = 0xBBC, // 3004 [dec] + READER_CARD_COMM_ERROR = 0xBBD, // 3005 [dec] + PC_READER_COMM_ERROR = 0xBBE, // 3006 [dec] + COMMIT_TRANSACTION_NO_REPLY = 0xBBF, // 3007 [dec] + COMMIT_TRANSACTION_ERROR = 0xBC0, // 3008 [dec] + NOT_SUPPORTED_KEY_TYPE = 0xBC2, // 3010 [dec] + WRONG_FILE_TYPE = 0xBC3, // 3011 [dec] + + DESFIRE_CARD_NO_CHANGES = 0x0C0C, + DESFIRE_CARD_OUT_OF_EEPROM_ERROR = 0x0C0E, + DESFIRE_CARD_ILLEGAL_COMMAND_CODE = 0x0C1C, + DESFIRE_CARD_INTEGRITY_ERROR = 0x0C1E, + DESFIRE_CARD_NO_SUCH_KEY = 0x0C40, + DESFIRE_CARD_LENGTH_ERROR = 0x0C7E, + DESFIRE_CARD_PERMISSION_DENIED = 0x0C9D, + DESFIRE_CARD_PARAMETER_ERROR = 0x0C9E, + DESFIRE_CARD_APPLICATION_NOT_FOUND = 0x0CA0, + DESFIRE_CARD_APPL_INTEGRITY_ERROR = 0x0CA1, + DESFIRE_CARD_AUTHENTICATION_ERROR = 0x0CAE, + DESFIRE_CARD_ADDITIONAL_FRAME = 0x0CAF, + DESFIRE_CARD_BOUNDARY_ERROR = 0x0CBE, + DESFIRE_CARD_PICC_INTEGRITY_ERROR = 0x0CC1, + DESFIRE_CARD_COMMAND_ABORTED = 0x0CCA, + DESFIRE_CARD_PICC_DISABLED_ERROR = 0x0CCD, + DESFIRE_CARD_COUNT_ERROR = 0x0CCE, + DESFIRE_CARD_DUPLICATE_ERROR = 0x0CDE, + DESFIRE_CARD_EEPROM_ERROR_DES = 0x0CEE, + DESFIRE_CARD_FILE_NOT_FOUND = 0x0CF0, + DESFIRE_CARD_FILE_INTEGRITY_ERROR = 0x0CF1, + DESFIRE_CATD_AUTHENTICATION_DELAY = 0X0CAD, + + // uFCoder library errors: + UFR_NOT_IMPLEMENTED = 0x1000, + UFR_COMMAND_FAILED = 0x1001, + UFR_TIMEOUT_ERR = 0x1002, + UFR_FILE_SYSTEM_ERROR = 0x1003, + UFR_FILE_SYSTEM_PATH_NOT_EXISTS = 0x1004, + UFR_FILE_NOT_EXISTS = 0x1005, + UFR_FTD2XX_DLL_NOT_FOUND = 0x1006, + + // uFCoder library/licensing specific + UFR_JSON_INVALID = 0x1012, + UFR_LICENSE_INVALID = 0x1013, + UFR_LICENSE_SAVE_FAILED = 0x1014, + UFR_LICENSE_NOT_FOUND = 0x1015, + UFR_LICENSE_HAS_EXPIRED = 0x1016, + + // SAM module error codes: + UFR_SAM_APDU_ERROR = 0x2000, + UFR_SAM_AUTH_ERROR, + UFR_SAM_CRYPTO_ERROR, + + // TLS, HTTPS Error Codes: + TLS_ERR_OPENING_SOCKET = 0x5000, + TLS_ERR_NO_SUCH_HOST = 0x5001, + TLS_CONNECTING_ERROR = 0x5002, + TLS_ERR_SERVER_UNEXPECTEDLY_CLOSED_CONNECTION = 0x5003, + TLS_ERR_UNKNOWN_GIDS_CERTIFICATE_FORMAT = 0x5004, + TLS_ERR_SET_PIN_FOR_GIDS_CERT_ONLY = 0x5005, + TLS_ERR_GIDS_PIN_CODE_WRONG = 0x5006, + TLS_ERR_UNSUPPORTED_CERTIFICATE_TYPE = 0x5007, + TLS_ERR_PRIVATE_KEY_CONTEXT_WRONG = 0x5008, + + // JC cards APDU Error Codes: + UFR_APDU_TRANSCEIVE_ERROR = 0xAE, + UFR_APDU_JC_APP_NOT_SELECTED = 0x6000, + UFR_APDU_JC_APP_BUFF_EMPTY = 0x6001, + UFR_APDU_WRONG_SELECT_RESPONSE = 0x6002, + UFR_APDU_WRONG_KEY_TYPE = 0x6003, + UFR_APDU_WRONG_KEY_SIZE = 0x6004, + UFR_APDU_WRONG_KEY_PARAMS = 0x6005, + UFR_APDU_WRONG_SIGNING_ALGORITHM = 0x6006, + UFR_APDU_PLAIN_TEXT_MAX_SIZE_EXCEEDED = 0x6007, + UFR_APDU_UNSUPPORTED_KEY_SIZE = 0x6008, + UFR_APDU_UNSUPPORTED_ALGORITHMS = 0x6009, + UFR_APDU_PKI_OBJECT_NOT_FOUND = 0x600A, + UFR_APDU_MAX_PIN_LENGTH_EXCEEDED = 0x600B, + UFR_DIGEST_LENGTH_DOES_NOT_MATCH = 0x600C, + + // reserved: 0x6100, + CRYPTO_SUBSYS_NOT_INITIALIZED = 0x6101, + CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR = 0x6102, + CRYPTO_SUBSYS_MAX_HASH_INPUT_EXCEEDED = 0x6103, + CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM = 0x6104, + CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM = 0x6105, + CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM = 0x6106, + CRYPTO_SUBSYS_WRONG_SIGNATURE = 0x6107, + CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH = 0x6108, + CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE = 0x6109, + CRYPTO_SUBSYS_HASHING_ERROR = 0x610A, + CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS = 0x610B, + CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY = 0x610C, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS = 0x610D, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY = 0x610E, + + UFR_WRONG_PEM_CERT_FORMAT = 0x61C0, + + // X.509 specific statuses: + X509_CAN_NOT_OPEN_FILE = 0x6200, + X509_WRONG_DATA = 0x6201, + X509_WRONG_LENGTH = 0x6202, + X509_UNSUPPORTED_PUBLIC_KEY_TYPE = 0x6203, + X509_UNSUPPORTED_PUBLIC_KEY_SIZE = 0x6204, + X509_UNSUPPORTED_PUBLIC_KEY_EXPONENT = 0x6205, + X509_EXTENSION_NOT_FOUND = 0x6206, + X509_WRONG_SIGNATURE = 0x6207, + X509_UNKNOWN_PUBLIC_KEY_TYPE = 0x6208, + X509_WRONG_RSA_PUBLIC_KEY_FORMAT = 0x6209, + X509_WRONG_ECC_PUBLIC_KEY_FORMAT = 0x620A, + X509_SIGNATURE_NOT_MATCH_CA_PUBLIC_KEY = 0x620B, + X509_UNSUPPORTED_SIGNATURE_SCH = 0x620C, + X509_UNSUPPORTED_ECC_CURVE = 0x620D, + + // PKCS#7 specific statuses: + PKCS7_WRONG_DATA = 0x6241, + PKCS7_UNSUPPORTED_SIGNATURE_SCHEME = 0x6242, + PKCS7_SIG_SCH_NOT_MATCH_CERT_KEY_TYPE = 0x6243, + + PKCS7_WRONG_SIGNATURE = 0x6247, + + // MRTD specific statuses: + MRTD_SECURE_CHANNEL_SESSION_FAILED = 0x6280, + MRTD_WRONG_SOD_DATA = 0x6281, + MRTD_WRONG_SOD_LENGTH = 0x6282, + MRTD_UNKNOWN_DIGEST_ALGORITHM = 0x6283, + MRTD_WARNING_DOES_NOT_CONTAINS_DS_CERT = 0x6284, + MRTD_DATA_GROUOP_INDEX_NOT_EXIST = 0x6285, + MRTD_EF_COM_WRONG_DATA = 0x6286, + MRTD_EF_DG_WRONG_DATA = 0x6287, + MRTD_EF_DG1_WRONG_LDS_VERSION_LENGTH = 0x6288, + MRTD_VERIFY_CSCA_NOT_EXIST = 0x6289, + MRTD_VERIFY_WRONG_DS_SIGNATURE = 0x628A, + MRTD_VERIFY_WRONG_CSCA_SIGNATURE = 0x628B, + MRTD_MRZ_CHECK_ERROR = 0x628C, + + // ICAO Master List specific statuses: + ICAO_ML_WRONG_FORMAT = 0x6300, + ICAO_ML_CAN_NOT_OPEN_FILE = 0x6301, + ICAO_ML_CAN_NOT_READ_FILE = 0x6302, + ICAO_ML_CERTIFICATE_NOT_FOUND = 0x6303, + ICAO_ML_WRONG_SIGNATURE = 0x6307, + + // EMV specific statuses + SYS_ERR_OUT_OF_MEMORY = 0x7001, + EMV_ERR_WRONG_INPUT_DATA = 0x7002, + EMV_ERR_MAX_TAG_LEN_BYTES_EXCEEDED = 0x7004, + EMV_ERR_TAG_NOT_FOUND = 0x7005, + EMV_ERR_TAG_WRONG_SIZE = 0x7006, + EMV_ERR_TAG_WRONG_TYPE = 0x7007, + EMV_ERR_IN_CARD_READER = 0x7008, + EMV_ERR_READING_RECORD = 0x7009, + EMV_ERR_PDOL_IS_EMPTY = 0x7010, + EMV_ERR_LIST_FORMAT_NOT_FOUND = 0x7011, + EMV_ERR_AFL_NOT_FOUND = 0x7012, + EMV_ERR_AID_NOT_FOUND = 0x7013, + + // ISO7816-4 Errors (R-APDU) - 2 SW bytes returned by the card, prefixed with 0x000A: + UFR_APDU_SW_TAG = 0x000A0000, + UFR_APDU_SW_OPERATION_IS_FAILED = 0x000A6300, + UFR_APDU_SW_WRONG_PIN_4_TRIES_REMAINING = 0x000A63C4, + UFR_APDU_SW_WRONG_PIN_3_TRIES_REMAINING = 0x000A63C3, + UFR_APDU_SW_WRONG_PIN_2_TRIES_REMAINING = 0x000A63C2, + UFR_APDU_SW_WRONG_PIN_1_TRIES_REMAINING = 0x000A63C1, + UFR_APDU_SW_WRONG_PIN_0_TRIES_REMAINING = 0x000A63C0, + UFR_APDU_SW_WRONG_LENGTH = 0x000A6700, + UFR_APDU_SW_SECURITY_STATUS_NOT_SATISFIED = 0x000A6982, + UFR_APDU_SW_AUTHENTICATION_METHOD_BLOCKED = 0x000A6983, + UFR_APDU_SW_DATA_INVALID = 0x000A6984, + UFR_APDU_SW_CONDITIONS_NOT_SATISFIED = 0x000A6985, + UFR_APDU_SW_WRONG_DATA = 0x000A6A80, + UFR_APDU_SW_FILE_NOT_FOUND = 0x000A6A82, + UFR_APDU_SW_RECORD_NOT_FOUND = 0x000A6A83, + UFR_APDU_SW_DATA_NOT_FOUND = 0x000A6A88, + UFR_APDU_SW_ENTITY_ALREADY_EXISTS = 0x000A6A89, + UFR_APDU_SW_INS_NOT_SUPPORTED = 0x000A6D00, + UFR_APDU_SW_NO_PRECISE_DIAGNOSTIC = 0x000A6F00, + + MAX_UFR_STATUS = 0x7FFFFFFF, + + UFR_DISPLAY_IMAGE_LOAD_ERROR = 0x8001, + UFR_DISPLAY_IMAGE_DIMENSION_ERROR = 0x8002, + UFR_DISPLAY_IMAGE_UNSUPPORTED_CHANNELS = 0x8003, + UFR_DISPLAY_WRITE_CMD_ERROR = 0x8004, + UFR_DISPLAY_READ_ACK_ERROR = 0x8005, + UFR_DISPLAY_WRITE_CMDEXT_ERROR = 0x8006, + UFR_DISPLAY_READ_RESPONSE_ERROR = 0x8007, + UFR_DISPLAY_TEXT_COUNT_OVERFLOW = 0x8008, + UFR_DISPLAY_INDEX_OVERFLOW = 0x8009, + UFR_DISPLAY_WRONG_SIMBOL_NUMB = 0x8010, + UFR_DISPLAY_COMMAND_FAILED = 0x8011 + +} UFR_STATUS; + +typedef enum UFCODER_SESSION_CODES +{ + UFR_SESSION_UNKNOWN_ERROR = 0x00, + UFR_SESSION_CLOSED = 0x01, + UFR_SESSION_EXPIRED = 0x02, + UFR_SESSION_DEVICE_DISCONNECTED = 0x03, + UFR_SESSION_DEVICE_FAILED_TO_CONNECT = 0x04, + + // BLE specific error codes + UFR_BLE_SESSION_ERROR_INVALID_PARAMETERS = 0x11, + UFR_BLE_SESSION_ERROR_INVALID_HANDLE = 0x12, + UFR_BLE_SESSION_ERROR_NOT_CONNECTED = 0x13, + UFR_BLE_SESSION_ERROR_OUT_OF_SPACE = 0x14, + UFR_BLE_SESSION_ERROR_OPERATION_CANCELLED = 0x15, + UFR_BLE_SESSION_ERROR_CONNECTION_TIMEOUT = 0x16, + UFR_BLE_SESSION_ERROR_UUID_NOT_ALLOWED = 0x17, + UFR_BLE_SESSION_ERROR_ALREADY_ADVERTISING = 0x18, + UFR_BLE_SESSION_ERROR_CONNECTION_LIMIT_REACHED = 0x19, + UFR_BLE_SESSION_ERROR_UNKNOWN_DEVICE = 0x20, + UFR_BLE_SESSION_ERROR_OPERATION_NOT_SUPPORTED = 0x21, + UFR_BLE_SESSION_ERROR_PEER_REMOVED_PAIRING_INFORMATION = 0x22, + UFR_BLE_SESSION_ERROR_ENCRYPTION_TIMED_OUT = 0x23, + UFR_BLE_SESSION_ERROR_TOO_MANY_LE_PAIRED_DEVICES = 0x24, + + // NFC specific error codes + + // Sesssion errors + UFR_NFC_SESSION_ERROR_FIRST_NDEF_TAG_READ = 0x30, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TERMINATED_UNEXPECTEDLY = 0x31, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TIMEOUT = 0x32, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_SYSTEM_IS_BUSY = 0x33, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_USER_CANCELED = 0x34, + + // NDEF errors + UFR_NFC_SESSION_ERROR_TAG_NOT_WRITABLE = 0x40, + UFR_NFC_SESSION_ERROR_TAG_SIZE_TOO_SMALL = 0x41, + UFR_NFC_SESSION_ERROR_TAG_UPDATE_FAILURE = 0x42, + UFR_NFC_SESSION_ERROR_ZERO_LENGTH_MESSAGE = 0x43, + + // Transceive errors + UFR_NFC_SESSION_ERROR_RETRY_EXCEEDED = 0x50, + UFR_NFC_SESSION_ERROR_TAG_CONNECTION_LOST = 0x51, + UFR_NFC_SESSION_ERROR_TAG_NOT_CONNECTED = 0x52, + UFR_NFC_SESSION_ERROR_TAG_RESPONSE_ERROR = 0x53, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_SESSION_INVALIDATED = 0x54, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_PACKET_TOO_LONG = 0x55, + + UFR_NFC_SESSION_ERROR_TAG_COMMAND_CONFIGURATION_INVALID_PARAMETERS = 0x56, + + // Other + UFR_NFC_SESSION_ERROR_UNSUPPORTED_FEATURE = 0x61, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER = 0x62, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER_LENGTH = 0x63, + UFR_NFC_SESSION_ERROR_PARAMETER_OUT_OF_BOUNDS = 0x64, + UFR_NFC_SESSION_ERROR_RADIO_DISABLED = 0x65, + UFR_NFC_SESSION_ERROR_SECURITY_VIOLATION = 0x66, + +} UFR_SESSION_STATUS; + +// DESFIRE key settings values +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE 0x09 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE 0x0F +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x01 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x08 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x0E +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x00 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x06 + +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x00 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x01 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x02 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x03 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x04 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x05 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x06 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x08 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x09 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0A +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0B +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTH_AUTH 0x0C +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTH_AUTH 0x0D +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0E +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0F + +enum E_ASYMMETRIC_KEY_TYPES +{ + RSA_PRIVATE_KEY = 0, + ECDSA_PRIVATE_KEY, + + ASYMMETRIC_KEY_TYPES_NUM +}; + +#define MAX_ECC_CURVE_NAME_LEN 30 + +enum E_ECC_CURVE_DEFINITION_TYPES +{ + ECC_CURVE_INDEX, + ECC_CURVE_NAME, + ECC_CURVE_DOMAIN_PARAMETERS, + + ECC_CURVE_DEFINITION_TYPES_NUM +}; + +enum E_SIGNATURE_SCHEMES +{ + SHA1_WITH_RSA, + SHA256_WITH_RSA, + SHA384_WITH_RSA, + SHA512_WITH_RSA, + SHA224_WITH_RSA, + SHA512_224_WITH_RSA, + SHA512_256_WITH_RSA, + + RSA_PSS, + + ECDSA_WITH_SHA1, + ECDSA_WITH_SHA256, + ECDSA_WITH_SHA384, + ECDSA_WITH_SHA512, + ECDSA_WITH_SHA224, + + SIGNATURE_SCHEMES_NUM // Don't change the order. NEVER! +}; +enum E_SIGNATURE_SCH_TYPES +{ + RSA_PKCS1, + RSA_PKCS1_PSS, + ECDSA, + + SIGNATURE_SCH_TYPES_NUM +}; +enum E_PUB_KEY_TYPES +{ + PUB_KEY_TYPE_RSA, + PUB_KEY_TYPE_ECDSA_NAMED_CURVE, + PUB_KEY_TYPE_ECDSA_DOMAIN_PARAMS, + + PUB_KEY_TYPES_NUM +}; + +enum E_BIT_ENCODINGS +{ + ENCODING_BIN, + ENCODING_HEX +}; + +enum E_CERTIFICATE_TYPES +{ + X509_PEM, + X509_DER, + X509_GIDS_NFC, + + E_CERTIFICATE_TYPES_NUM +}; + +enum E_ECC_CURVES +{ + secp112r1, + secp112r2, + secp128r1, + secp128r2, + secp160r1, + secp160r2, + secp160k1, + secp192r1, + prime192v2, + prime192v3, + secp192k1, + secp224r1, + secp224k1, + secp256r1, + secp256k1, + secp384r1, + secp521r1, + prime239v1, + prime239v2, + prime239v3, + brainpoolP160r1, + brainpoolP192r1, + brainpoolP224r1, + brainpoolP256r1, + brainpoolP320r1, + brainpoolP384r1, + brainpoolP512r1, + brainpoolP160t1, + brainpoolP192t1, + brainpoolP224t1, + brainpoolP256t1, + brainpoolP320t1, + brainpoolP384t1, + brainpoolP512t1, + + ECC_CURVES_NUM + + /* Not supported in uFCoder library yet: + sect113r1, + sect113r2, + sect131r1, + sect131r2, + sect163k1, + sect163r1, + sect163r2, + sect193r1, + sect193r2, + sect233k1, + sect233r1, + sect239k1, + sect283k1, + sect283r1, + sect409k1, + sect409r1, + sect571k1, + sect571r1 + */ +}; +// #define F2M_CURVES sect113r1 + +typedef struct +{ + uint8_t *serial; + uint8_t *subject; + uint8_t *issuer; + uint8_t *SKI; + uint8_t *AKI; + uint32_t serial_len; + uint32_t subject_len; + uint32_t issuer_len; + uint32_t SKI_len; + uint32_t AKI_len; +} icaoMlSearchCriteria_t; + +typedef struct +{ + uint32_t ecc_curve_field_type; + void *field_domain_params; // To be defined. For now only a named primary field curves are supported. +} ecc_curve_domain_params_t; + +typedef struct +{ + uint32_t ecc_curve_definition_type; // one of the E_ECC_CURVE_DEFINITION_TYPES + uint32_t ecc_curve_index; + char *ecc_curve_name; + ecc_curve_domain_params_t *ecc_curve_domain_params; +} ecc_key_param_t; + +enum E_MRTD_IMG_TYPE +{ + MRTD_IMG_JPEG = 0, + MRTD_IMG_JP2 = 1, + MRTD_IMG_JPEG2000 = 1, // Alias for the MRTD_IMG_JP2 + + MRTD_IMG_TYPE_UNKNOWN = 0xFFFFFFFF +}; + +typedef enum +{ + USER_PIN = 0, + SO_PIN, + USER_PUK, + SO_PUK +} dl_sec_code_t; + +enum E_PRINT_VERBOSE_LEVELS +{ + PRINT_NONE, + PRINT_ESSENTIALS, + PRINT_DETAILS, + PRINT_ALL_PLUS_STATUSES, +}; + +// SAM definition +typedef enum E_SAM_HW_VER +{ + SAM_UNKNOWN_TYPE, + SAM_T1AD2060_AV1_MODE, + SAM_T1AD2060_AV2_MODE, + SAM_T1AR1070_AV1_MODE, + SAM_T1AR1070_AV2_MODE +} SAM_HW_TYPE; + +// Reader status +typedef enum E_EMULATION_MODES +{ + TAG_EMU_DISABLED, + TAG_EMU_DEDICATED, + TAG_EMU_COMBINED, + TAG_EMU_AUTO_AD_HOC +} emul_modes_t; + +typedef enum E_EMULATION_STATES +{ + EMULATION_NONE, + EMULATION_IDLE, + EMULATION_AUTO_COLL, + EMULATION_ACTIVE, + EMULATION_HALT, + EMULATION_POWER_OFF +} emul_states_t; + +typedef enum E_PCD_MGR_STATES +{ + PCD_MGR_NO_RF_GENERATED, + PCD_MGR_14443A_POLLING, + PCD_MGR_14443A_SELECTED, + PCD_MGR_CE_DEDICATED, + PCD_MGR_CE_COMBO_START, + PCD_MGR_CE_COMBO, + PCD_MGR_CE_COMBO_IN_FIELD +} pcd_states_t; + +enum E_RGB_PORT_NAMES +{ + EXTERNAL_RGB_PORT, + INTERNAL_RGB_PORT +}; + +enum E_CUSTOM_UI_IDLE_MODES +{ + CUSTOM_UI_IDLE_MODE_NONE = 0, + CUSTOM_UI_IDLE_MODE_STATIC_LED, + CUSTOM_UI_IDLE_MODE_BLINKING_LED, + CUSTOM_UI_IDLE_MODES_NUMBER_INDICATOR +}; + +enum E_CUSTOM_UI_DETECTED_MODES +{ + CUSTOM_UI_DETECTED_MODE_NONE = 0, + CUSTOM_UI_DETECTED_MODE_STATIC_LED, + CUSTOM_UI_DETECTED_MODE_STATIC_LED_BEEP, + CUSTOM_UI_DETECTED_MODE_BEEP, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED_BEEP, + CUSTOM_UI_DETECTED_MODES_NUMBER_INDICATOR +}; + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * @defgroup INTERNAL !!!INTERNAL!!! uFR API calls (Not for public SDK use) (remove from final revision) + * @{ + */ + /** @} */ // end of defgroup INTERNAL + + /** + * @defgroup UNDOCUMENTED UNDOCUMENTED uFR API calls (remove from final revision) + * @brief Excluded from docs due to the nature of their usage + * @{ + */ + /**@}*/ // end of defgroup INTERNAL + + /** @defgroup LibLic Library licensing + * @brief Prerequisite API calls for facilitating use of uFR MDK (Mobile Development Kit) with Android/iOS devices (usage of mobile device internal NFC antenna) + * @{ + */ + /** @} */ // end of LibLic + + /** @defgroup SingleReader Single Reader + * @{ + */ + /** @defgroup ReaderAndLibrary Reader and library + ** @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication + + /** @defgroup ReaderAndLibrary_Information Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information + + /** @defgroup ReaderAndLibrary_EEPROM EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM + + /** @defgroup ReaderAndLibrary_Signalization Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization + + /** @defgroup ReaderAndLibrary_RGBSignalization RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL. + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl Display Control + * @since uFCoder library version 6.0.5 + * + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFROnlineCommands uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands + + /** @defgroup ReaderAndLibrary_BaseHDUFR uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR + + /** @defgroup ReaderAndLibrary_NXPSAM Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM + + /** @defgroup ReaderAndLibrary_HelperFunc Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc + + /**@}*/ // end of defgroup ReaderAndLibrary + + /** @defgroup Card_Tag Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockRead(), BlockWrite(), LinearRead(), LinearWrite() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF + + /** @defgroup Card_Tag_NTAG_2XX NTAG2XX (Type 2) specific commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG + + /** @defgroup Card_Tag_NT4H NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H + + /** @defgroup Card_Tag_Mifare_Desfire Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire + + /** @defgroup Card_Tag_Mifare_Desfire_Light Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Desfire_Light + + /** @defgroup Card_Tag_Mifare_Plus Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Plus + + /** @defgroup Card_Tag_Ultralight_C Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Ultralight_C + + /** @defgroup Card_Tag_JavaCardApplication Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication + + /** @defgroup Card_Tag_CardFeatures Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4 ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4 + + /** @defgroup Card_Tag_CardFeatures_ISO7816 ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816 + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification + + /** @defgroup Card_Tag_CardFeatures_MRTD Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD + + /** @defgroup Card_Tag_CardFeatures_TLS TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS + + /** @defgroup Card_Tag_CardFeatures_EMV Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV + + /** @defgroup Card_Tag_CardFeatures_AntiCollision Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode + + /**@}*/ // end of defgroup Card_Tag_CardFeatures + + /**@}*/ // end of defgroup Card_Tag + + /** @defgroup Miscellaneous Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous + + /**@}*/ // end of defgroup SingleReader + + /** @defgroup MultiReader MultiReader + * @{ + ** @defgroup ReaderAndLibrary_ReaderList Handling multiple readers + * @brief If you want to communicate and use multiple readers from an application, you have to follow the + * initial procedure for enumerating uFR compatible devices and getting their handles + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_ReaderList + + /** @defgroup ReaderAndLibrary_M Reader and library + * @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication_M Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication_M + + /** @defgroup ReaderAndLibrary_Information_M Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information_M + + /** @defgroup ReaderAndLibrary_EEPROM_M EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM_M + + /** @defgroup ReaderAndLibrary_Signalization_M Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization_M + + /** @defgroup ReaderAndLibrary_RGBSignalization_M RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_M Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFROnlineCommands_M uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands_M + + /** @defgroup ReaderAndLibrary_BaseHDUFR_M uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR_M + + /** @defgroup ReaderAndLibrary_NXPSAM_M Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM_M + + /** @defgroup ReaderAndLibrary_HelperFunc_M Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc_M + + /**@}*/ // end of defgroup ReaderAndLibrary_M + + /** @defgroup Card_Tag_M Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General_M General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare_M Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockReadM(), BlockWriteM(), LinearReadM(), LinearWriteM() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF_M NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF_M + + /** @defgroup Card_Tag_NTAG_2XX_M NTAG2XX (Type 2) related commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG_2XX_M + + /** @defgroup Card_Tag_NT4H_M NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H_M + + /** @defgroup Card_Tag_Mifare_Desfire_M Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_M + + /** @defgroup Card_Tag_Mifare_Desfire_Light_M Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_Light_M + + /** @defgroup Card_Tag_Mifare_Plus_M Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Plus_M + + /** @defgroup Card_Tag_Ultralight_C_M Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Ultralight_C_M + + /** @defgroup Card_Tag_JavaCardApplication_M Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common_M Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common_M + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage_M DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage_M + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_M + + /** @defgroup Card_Tag_CardFeatures_M Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking_M Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking_M + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4_M ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4_M + + /** @defgroup Card_Tag_CardFeatures_ISO7816_M ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816_M + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M + + /** @defgroup Card_Tag_CardFeatures_MRTD_M Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD_M + + /** @defgroup Card_Tag_CardFeatures_TLS_M TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS_M + + /** @defgroup Card_Tag_CardFeatures_EMV_M Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV_M + + /** @defgroup Card_Tag_CardFeatures_AntiCollision_M Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision_M + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode_M Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode_M + + /**@}*/ // end of defgroup Card_Tag_CardFeatures_M + + /**@}*/ // end of defgroup Card_Tag_M + + /** @defgroup Miscellaneous_M Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous_M + + /**@}*/ // end of defgroup MultiReader + + /** @defgroup uFR_MDK uFR MDK (Mobile Development Kit) + * @since uFCoder library version 6.0.0 + * + * Using the internal NFC antenna of a mobile device is supported in the uFCoder library through the usage of ReaderOpenEx() with appropriate parameters. + * It is mandatory to obtain a valid DLogic license to make use of the uFR MDK. + * License can be obtained automatically through the ReaderOpenEx() API call. + * Or using the GetLicenseRequestData() and our online service found at: https://liblic.d-logic.com/
+ * Refer to @ref LibLic group for details. + * + * @{ + */ + /** @defgroup uFR_MDK_Android Android + * @brief uFR MDK for Android currently has support for the NTAG2XX, Mifare Classic®, Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * @{ + */ + /** @defgroup uFR_MDK_Android_NTAG2XX NTAG2XX with NDEF support + * @brief Supported API calls for NTAG2XX (e.g NTAG203/210/213/215/216) cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * read_ndef_record() + * * write_ndef_record() + * * write_ndef_record_mirroring() + * * write_ndef_record_mirroring_tt() + * * get_ndef_record_count() + * * erase_last_ndef_record() + * * erase_all_ndef_records() + * * ndef_card_initialization() + * * WriteNdefRecord_WiFi() + * * WriteNdefRecord_BT() + * * WriteNdefRecord_SMS() + * * WriteNdefRecord_Bitcoin() + * * WriteNdefRecord_GeoLocation() + * * WriteNdefRecord_NaviDestination() + * * WriteNdefRecord_Email() + * * WriteNdefRecord_Address() + * * WriteNdefRecord_AndroidApp() + * * WriteNdefRecord_Text() + * * WriteNdefRecord_StreetView() + * * WriteNdefRecord_Skype() + * * WriteNdefRecord_Whatsapp() + * * WriteNdefRecord_Viber() + * * WriteNdefRecord_Contact() + * * WriteNdefRecord_Phone() + * * ReadNdefRecord_WiFi() + * * ReadNdefRecord_Bitcoin() + * * ReadNdefRecord_GeoLocation() + * * ReadNdefRecord_NaviDestination() + * * ReadNdefRecord_Email() + * * ReadNdefRecord_Address() + * * ReadNdefRecord_AndroidApp() + * * ReadNdefRecord_Text() + * * ReadNdefRecord_StreetView() + * * ReadNdefRecord_Skype() + * * ReadNdefRecord_Whatsapp() + * * ReadNdefRecord_Viber() + * * ReadNdefRecord_Contact() + * * ReadNdefRecord_Phone() + * * ReadNdefRecord_SMS() + * * ReadNdefRecord_BT() + * * ParseNdefMessage() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_NTAG2XX + + /** @defgroup uFR_MDK_Android_Mifare Mifare Classic + * @brief Supported API calls for Mifare Classic cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * SectorTrailerWrite_PK() + * * SectorTrailerWriteUnsafe_PK() + * * ValueBlockRead_PK() + * * ValueBlockWrite_PK() + * * ValueBlockInSectorRead_PK() + * * ValueBlockInSectorWrite_PK() + * * ValueBlockIncrement_PK() + * * ValueBlockDecrement_PK() + * * ValueBlockInSectorIncrement_PK() + * * ValueBlockInSectorDecrement_PK() + * * LinearFormatCard_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Mifare + + /** @defgroup uFR_MDK_Android_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth() + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth() + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Desfire + + /** @defgroup uFR_MDK_Android_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_Android + + /** @defgroup uFR_MDK_iOS iOS + * @brief uFR MDK for IOS currently has support only for Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * + * @{ + */ + /** @defgroup uFR_MDK_iOS_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_iOS_Desfire + + + /** @defgroup uFR_MDK_IOS_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_IOS_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_iOS + + /**@}*/ // end of defgroup uFR_MDK + + //-------------------------------------------------------------------------------------------------- + /** + * @brief Used to generate license request necessary for obtaing valid uFCoder license separately. + * + * Parameter "license_request" will hold a JSON string value that is to be used for our online front-end service for generating an offline license. + * The online service is found at: https://liblic.d-logic.com/ + * + * @ingroup LibLic + * + * @param months Number of months requested for the license + * @param license_request JSON string formed with licensing parameters + * + */ + void DL_API GetLicenseRequestData(uint32_t months, OUT char *license_request); + + /** + * @brief Used to validate and store an offline Dlogic license for future usage. + * + * @ingroup LibLic + * + * @param license_str JSON string containing full license data + * + * @return Operation status + */ + UFR_STATUS DL_API SetLicenseData(c_string license_str); + + /** + * @brief Opens reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s. If you have more than one µFR Online device, ReaderOpen function will open the first one found, for the device not connected to the PC via cable, use ReaderOpenEx() instead. + *
+ * NOTE: On Android, using ReaderOpen() will establish communication with uFR Series readers connected via OTG cable. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen(void); + + /** + * @brief Opens a port of connected reader using readers family type. Useful for speed up opening for non uFR basic reader type (e.g. BaseHD with uFR support). + * + * Do not use this function for opening communication with µFR Online devices. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenByType(uint32_t reader_type); + + enum E_READER_TYPE + { + AUTO = 0, + UFR_TYPE = 1, + UFR_RS232_TYPE = 2, + BASEHD_UFR_TYPE = 3, + UFR_ONLINE_TYPE = 4, + INTERNAL_NFC = 5 + }; + + /** + * @brief Open reader communication port in several different ways. Can be used for establishing communication with COM port too. + * + * There is enumeration in uFCoder.h file called E_READER_TYPE with values: + * enum E_READER_TYPE + * { + * AUTO = 0, + * UFR_TYPE = 1, + * UFR_RS232_TYPE = 2, + * BASEHD_UFR_TYPE = 3, + * UFR_ONLINE_TYPE = 4, + * INTERNAL_NFC = 5 + * }; + * Values in this enumeration you can pass into ReaderOpenEx function as reader_type parameter.
+ * For example, if you pass 4 as reader_type it will only work with µFR Online Series devices, and then as port_name you can pass devices IP address or serial number (ex: “192.168.1.123” or “ON101390”), for port_interface you can pass ‘U’ for UDP, ‘T’ for TCP or 0. + * If you pass 0, it will automatically search for reader working mode (UDP or TCP) and open it. For argument you can pass 0 or µFR Nano device serial number to open it on 1Mbit/s (ex: “UN123456”).
+ * Using value 5 as reader_type implies usage of internal mobile device NFC. + * Upon a call to ReaderOpenEx with this parameter, the library will try to obtain license automatically via HTTP. + * On success, a valid license is stored for future use. On failure, it moves to looking up for stored licenses. Results other than UFR_OK status imply a corresponding error that occurred and as such use of internal mobile device NFC will be unavailable. + * When using 5 as reader_type, additionally you can specify port_interface parameter to decide whether to do online->offline validation or just offline. To use offline-only validation of a previously stored valid DLogic license, set port_interface to 1. + * Value 0 is default value for port_interface and implies online->offline license validation. + * More examples for port open are given in the “Reader Open Examples” document: + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-doc/blob/master/Reader_Open_Examples.pdf + * Examples: + * ReaderOpenEx(1, “COM1”, 0, 0) + * This example will open communication with µFR device attached to COM1 port on 1Mbit/s + * ReaderOpenEx(1, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR device on 1Mbit/s + * ReaderOpenEx(2, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR RS232 device on 115200 bit/s + * ReaderOpenEx(4, “ON123456”, ‘U’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on UDP protocol. + * ReaderOpenEx(4, “ON123456”, ‘T’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘U’, 0) + * This example will open communication with µFR Online reader with IP address 192.168.1.123 on UDP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘T’, 0) + * This will open communication with µFR Online reader with IP address 192.168.1.123 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, 0, 0) + * It will open communication with µFR Online reader with IP address 192.168.1.123 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, 0) + * It will open communication with µFR Online reader with serial number ON123456 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with serial number ON123456 + * ReaderOpenEx(4, “192.168.1.123”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with IP address 192.168.1.123 + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) When uFR Online reader works in BT serial mode or transparent mode, reader_type must be set to 1. + * @param port_name is c-string type used to open port by given serial name. If you provide NULL or empty string that is AUTO MODE which calls ReaderOpenEx() and all available ports on the system. serial port name, identifier, like "COM3" on Windows or "/dev/ttyS0" on Linux or "/dev/tty.serial1" on OS X or if you select FTDI, reader serial number like "UN123456", if reader have integrated FTDI interface When the UDP interface type is selected, port_name must be provided in “address:port” format. Like "192.168.1.162:8881" IP for UDP I/F + * @param port_interface type of communication interfaces (define interface which we use while connecting to the printer), supported value's: 0 : auto - first try FTDI than serial if port_name is not defined 1 : try serial / virtual COM port / interfaces 2 : try only FTDI communication interfaces 10 : try to open Digital Logic Shields with RS232 uFReader on Raspberry Pi (serial interfaces with GPIO reset) 84 ('T') : TCP/IP interface 85 ('U') : UDP interface 102 ('B'): BT serial interface. Android library only. 114 ('L'): BLE interface. Android library only. When uFR Online reader works in BT serial mode, port_interface must be set to 0 (Except Android). arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * @param arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenEx(uint32_t reader_type, IN c_string port_name, uint32_t port_interface, IN void *arg); + + /** + * @brief Opens uFR Online device by serial number. + * + * Function will open communication (UDP or TCP) with device based on its working mode. If function cannot find given serial number, it will open communication on serial port with 1Mbit/s. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param serial_number Pointer to const char array (c_string) containing devices serial number (ex. “ON101390”). + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen_uFROnline(c_string serial_number); + + /** + * @brief Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderReset(void); + + /** + * @brief Physical reset of reader communication port & tests the communication before returning a UFR_STATUS code. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetWait(void); + + /** + * @brief Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderClose(void); + + /** + * @brief This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestart(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderHwReset(void); + + /** + * @brief Used to get the FTDI D2XX driver version number. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major: Byte value indicating driver version major number + * @param version_minor: Byte value indicating driver version minor number + * @param build: Byte value indicating driver version build number + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor, VAR uint8_t* build); + + /** + * @brief Used to get the FTDI D2XX driver version number as c-string. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_str: buffer that will contain driver version as c-string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersionStr(OUT char *version_str); + + /** + * @brief Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderType(IN uint32_t *lpulReaderType); + + /** + * @brief Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumber(IN uint32_t *lpulSerialNumber); + + /** + * @brief Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information + * + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnected(VAR uint32_t *connected); + + /** + * @brief Store a new key or change existing key under provided index parameter. + * + * The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWrite(IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLock(IN const uint8_t *password); + + /** + * @brief Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlock(IN const uint8_t *password); + + /** + * @brief This function turns sound and light reader signals. + * + * Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignal(uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). + * + * Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolume(uint8_t sound_volume); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserData(OUT uint8_t *aucData); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExt(OUT uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 byte array containing user data + * @return Operation status + */ + UFR_STATUS DL_API WriteUserData(IN const uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 byte array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExt(IN const uint8_t *aucData); + + /** + * @brief Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). + * + * We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @ingroup Card_Tag_General + * + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardId(VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * @ingroup Miscellaneous + * + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSak(VAR uint16_t *atqa, VAR uint8_t *sak); + + /** + * @brief Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKey(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKey(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKey(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKey(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKey(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesWritten, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * The method for proving authenticity is determined by the suffix in the functions names. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKey(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKey(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKey(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKey(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKey(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKey(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKey(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. + * + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Provided Key mode (PK) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PK(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PK(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PK(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PK(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PK(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PK(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PK(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PK(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PK(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PK(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PK(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTime(VAR uint8_t *time); + + /** + * @brief Function sets the date and time into the device's RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param password pointer to the 8 bytes array containing password time pointer to the 6 bytes array containing date and time representation + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTime(IN uint8_t *password, VAR uint8_t *time); + + /** + * @brief This function is used in Common, Advance and Access Control set of functions. + * + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM. Maximal length of array is 128 bytes. + * + * Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * @param password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeSector(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeBlock(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BusAdminCardMake(uint32_t serial, IN uint8_t *password); + + /** + * @brief Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information + * + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescription(OUT uint8_t pSerialDescription[8]); + + /** + * @brief Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information + * + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumber(VAR uint8_t *build); + + /** + * @brief This function returns UID of card actually present in RF field of reader. It can handle all three known types : 4, 7 and 10 byte long UIDs. + * + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi-card (anti collision) mode: + //------------------------------------------------------------------------------ + /** + * @brief This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollision(void); + + /** + * @brief Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollision(void); + + /** + * @brief If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. + * + * Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCards(VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + /** + * @brief For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. + * + * First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * Before calling this function you have to call EnumCards() first. + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCards(OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + /** + * @brief Selects one of the cards which UID is on the actual UID list of the enumerated cards. + * + * If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCard(IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. + * + * Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCard(void); + + /** + * @brief Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatus(VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + //------------------------------------------------------------------------------ + /** + * @brief This function returns card type according to DlogicCardType enumeration. + * + * For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General + * + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardType(VAR uint8_t *lpucCardType); + + /** + * @brief This function returns 8 bytes of the T2T version. + * + * All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersion(OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). + * + * The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General + * + * @param lpulLinearSize pointer to variable which contain size of user data space lpulRawSize pointer to variable which contain size of total data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSize(VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * @ingroup Miscellaneous + * + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatus(OUT uint8_t *tt_message, VAR uint8_t *tt_status); + //------------------------------------------------------------------------------ + /** + * @brief Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. + * + * The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @ingroup Card_Tag + * + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalData(OUT uint8_t data[32], VAR uint32_t *len); + + /** + * @brief Function returns reader’s serialized discovery loop structure. + * + * C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetup(OUT uint8_t *setupStruct, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoop(IN const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Function returns the AID set in the reader to retrieve the mobile phone's unique ID. + * + * If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAid(OUT uint8_t *aid, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAid(IN const uint8_t *aid, uint32_t len); + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfig(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtp(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlot(uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKey(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencrypted(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKey(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZone(uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZone(uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatus(VAR uint8_t *bool_config_zone_locked, VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevision(uint8_t revision[4]); + //------------------------------------------------------------------------------ + + // uFCoder PRO MODE + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProMode(VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProMode(const uint32_t ReaderProMode); + + // QR barcode crypt algorithm + // initialization. with TB serial like 'TB123456' + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_Initialize(IN const uint8_t *TBSerialString, uint16_t job_number); + + // You must define 25 bytes array in memory for out_card_data[] + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCard(const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + enum CARD_ENCRYPTION_CODE_TYPE + { + CODE_TYPE_STANDARD, + CODE_TYPE_GROUP, + CODE_TYPE_DAILY_RANGE, // valid from, but only to_timestamp / every day + }; + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNext(const uint32_t code_type, const uint32_t from_timestamp, const uint32_t to_timestamp, + const uint32_t additional_data_size, IN const uint8_t additional_data[], + VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSN(OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSN(VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSN(OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Function returns TNF, type of record, ID and payload from the NDEF record. + * + * NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_record(uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. + * + * Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, IN uint8_t *id, + IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, VAR uint8_t *card_formated); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_tt(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, + int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. + * + * Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_count(VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, OUT uint8_t *ndef_record_array, + VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_record(uint8_t message_nr); + + /** + * @brief Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_records(uint8_t message_nr); + + /** + * @brief Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. + * + * If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initialization(void); + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + /** + * @brief Function stores a message record for NTAG emulation mode into the reader. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdef(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief This function does the same as WriteEmulationNdef() function with the addition of an AAR embedded in to the NDEF message. + * + * AAR stands for “Android Application Record”. AAR is a special type of NDEF record that is used by Google’s Android operating system to signify to an NFC phone that an explicitly defined Android Application which should be used to handle an emulated NFC tag. Android App record will be added as the 2nd NDEF record in the NDEF message. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record type_record pointer to the array containing record type type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param type_record pointer to the array containing record type + * @param type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param id pointer to the array containing record ID + * @param id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param aar pointer to the array containing AAR record + * @param aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefWithAAR(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length, IN uint8_t *aar, uint8_t aar_length); + + /** + * @brief Put the reader permanently in a NDEF tag emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStart(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStop(void); + + /** + * @brief Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStart(void); + + /** + * @brief Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). + * + * uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStart(void); + + /** + * @brief Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStop(void); + + /** + * @brief This function returns current ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParams(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief This command set ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 CombinedModeEmulationStart Function description Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. Function declaration (C language) UFR_STATUS CombinedModeEmulationStart(void); Function takes no parameters. ________________ Support for ISO14443-4 protocol + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParams(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param is_field_present value representing whehter field is present (1) or not (0) + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldState(VAR uint8_t *is_field_present); + + /** + * @brief Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommMode(void); + + /** + * @brief The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommMode(void); + + /** + * @brief Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRam(IN uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data buffer containing ram data returned + * @param addr address from which to read reader RAM + * @param data_len length of data to read from RAM + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRam(OUT uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function stores a message record for NTAG emulation mode into the reader in the RAM. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRam(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, + IN uint8_t *id, uint8_t id_length, IN uint8_t *payload, uint32_t payload_length); + + /** + * @brief Put the reader permanently in a NDEF tag in RAM emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStopRam() function), or by reader reset. Use the function GetReaderStatus to check if the reader is still in emulation mode (maybe the reader was reset for some reason). + * From library version 5.0.31, and firmware version 5.0.31 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartRam(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopRam(void); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value sets to 0. + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value stays unchangeable. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterNonResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function disables the NFC counter in the card emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterDisabled(void); + + //------------------------------------------------------------------------------ + + // GetNfcT2TVersion() returns 8 bytes (see T2T documentation): + typedef struct t2t_version_struct + { + uint8_t header; + uint8_t vendor_id; + uint8_t product_type; + uint8_t product_subtype; + uint8_t major_product_version; + uint8_t minor_product_version; + uint8_t storage_size; + uint8_t protocol_type; + } t2t_version_t; + + // NfcT2TSafeConvertVersion() returns converts version_record that returned from GetNfcT2TVersion() + // or GetNfcT2TVersionM(). Conversion is "alignment safe" + // (you don't need to pay attention on structure byte alignment): + /** + * @brief This is a helper function for converting raw array of 8 bytes received by calling GetNfcT2TVersion(). + * + * All modern T2T chips having same or very similar structure of the T2T version data represented in the uFR API by the structure type t2t_version_t: + * typedef struct t2t_version_struct { + * uint8_t header; + * uint8_t vendor_id; + * uint8_t product_type; + * uint8_t product_subtype; + * uint8_t major_product_version; + * uint8_t minor_product_version; + * uint8_t storage_size; + * uint8_t protocol_type; + * } t2t_version_t; + * This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). Conversion done by this function is "alignment safe". + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param version pointer to the structure of the t2t_version_t type which will receive converted T2T version + * @param version_record pointer to array containing 8 bytes of the raw T2T version acquired using function GetNfcT2TVersion() + * + */ + void DL_API NfcT2TSafeConvertVersion(t2t_version_t *version, const uint8_t *version_record); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignature(OUT uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], VAR uint8_t *lpucUidLen, + VAR uint8_t *lpucDlogicCardType); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExt(OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + /** + * @brief This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounter(uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounter(uint8_t counter_address, uint32_t inc_value); + + /** + * @brief This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. + * + * If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounter(VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RK(VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Provided Key mode (PK) This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PK(VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfig(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigEx(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfig(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigEx(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only. Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode idle mode value + * @param card_detection_mode card detection mode value + * @param idle_color idle color value(RGB) + * @param card_detection_color card detection color value(RGB) + * @param enabled enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfig(uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only. Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode pointer to idle mode value + * @param card_detection_mode pointer to card detection mode value + * @param idle_color pointer to idle color value(RGB) + * @param card_detection_color pointer to card detection color value(RGB) + * @param enabled pointer to enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfig(uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_number(VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, uint8_t start_hour, + uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record(uint8_t record_number, VAR uint16_t *first_reader_nr, VAR uint16_t *last_reader_nr, + VAR uint8_t *start_hour, VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_record(uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_record(uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, uint8_t begin_hour, + uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, uint8_t end_hour, + uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_record(VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, VAR uint8_t *end_month, + VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_type(uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_type(VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_duration(uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_duration(VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_duration(uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_duration(VAR uint32_t *duration); + + // swimming pool ************************************************************** + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validity(VAR int32_t *credit, VAR uint32_t *begin_year, VAR uint32_t *begin_month, + VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, // + VAR uint32_t *end_year, VAR uint32_t *end_month, VAR uint32_t *end_day, + VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validity(int32_t credit, uint32_t begin_year, uint32_t begin_month, uint32_t begin_day, + uint32_t begin_hour, + uint32_t begin_minute, // + uint32_t end_year, uint32_t end_month, uint32_t end_day, uint32_t end_hour, + uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_record(uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_record(uint8_t record_number, VAR uint8_t *right_record_type, OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counter(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, + uint8_t end_minute, IN uint8_t *days, uint8_t max_daily_counter); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record_type_max_daily_counter(uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, + VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days, VAR uint8_t *max_daily_counter); + + //============================================================================= + + /** + * @brief Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOn(uint16_t pulse_duration); + + /** + * @brief Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayState(uint8_t state); + + /** + * @brief Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param intercom shows that there is voltage at the terminals for intercom connection, or notss + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoState(VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControl(uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Function gets the state of the input pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param input_nr ordinal number of hardware specific input pin input_state input state 1 or 0. + * @param input_state input state 1 or 0. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetInputState(uint8_t input_nr, VAR uint8_t *input_state); + + /** + * @brief This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControl(uint8_t light_status); + + /** + * @brief For classic uFR PLUS devices only. The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. + * + * This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControl(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Sets the color of the RGB diodes. + * + * This color stays on the RGB diodes until the function GreenLedBlinkingTurnOn() is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity(). + * Before this function call, the function GreenLedBlinkingTurnOff() must be called, or the reader is already in mode of blocking automatic signalization. + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControl(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControl(uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes. + * + * This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleep(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. + * + * In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. + * Function also sets the number of omitted activity periods, when the RGB light is off. + * For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriod(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSet(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefault(void); + + /** + * @brief The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. + * + * Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMax(uint8_t bad_select_nr_max); + + /** + * @brief The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMax(VAR uint8_t *bad_select_nr_max); + + /** + * @brief Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepMode(void); + + /** + * @brief Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepMode(void); + + /** + * @brief Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSet(uint8_t seconds_wait); + + /** + * @brief Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGet(VAR uint8_t *seconds_wait); + + /** + * @brief This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanently(unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParameters(VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. + * + * Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. + * The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. + * For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayData(IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Function has the same functionality as the function SetDisplayData(). New feature is the RGB port selection. + * + * Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbData(IN uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequency(uint16_t frequency); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * SetRgbIntensity()(alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * GetRgbIntensity (alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensity(VAR uint8_t *intensity); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRgbIntensity(VAR uint8_t *intensity); + // DESFIRE functions ************************************************************** + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode(void); + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATS(OUT uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorage(void); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceive(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint32_t *ufr_status); + + /** + * @brief Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Transceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, uint8_t data_out_len, + OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, uint8_t send_le, + OUT uint8_t *apdu_status); + + /** + * @brief Sends C–APDU in the c_string (zero terminated) format, containing pairs of the hexadecimal digits. + * + * Pairs of the hexadecimal digits can be delimited by any of the punctuation characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu C-APDU hexadecimal c_string + * @param r_apdu Received R-APDU as a hexadecimal c_string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceive(IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are sent and receive in the form of the byte arrays. + * + * There is obvious need for a c_apdu_len and *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceive(IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @param c_apdu array containing C_APDU + * @param c_apdu_len length of C_APDU + * @param r_apdu buffer that will store R_APDU + * @param r_apdu_len returns length of R_APDU + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeap(IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief This is “exploded binary” alternative function intended for support APDU commands in ISO 14443-4A tags. + * APDUTransceive() receives separated parameters which are an integral part of the C– APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls cls + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, uint32_t Nc, + OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chain(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint8_t *rcv_chained, + VAR uint32_t *ufr_status); + + /** + * @brief R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceive(uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselect(uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * @ingroup UNDOCUMENTED + * + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive(uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, uint8_t crypto1, + uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Function sets the parameters for transceive mode. + * + * If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_start(uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stop(void); + + /** + * @brief Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enable(void); + + /** + * @brief The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending rcv_data pointer to data array received from card bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceive(IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, uint32_t bytes_to_receive, + VAR uint32_t *rcv_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interface(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_Generic(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interface(void); + + /** + * @brief Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDU(void); + + /** + * @brief Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4(void); + + /** + * @brief Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interface(void); + + /** + * @brief APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interface(void); + + //============================================================================== + /** + * @brief Using this function you can select the appropriate application on the card. + * + * For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAid(IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief In JCApp cards you can put two types of asymmetric crypto keys. + * + * Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKey(uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + const IN uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPair(uint8_t key_type, uint8_t key_index, uint8_t key_designator, uint16_t key_bit_len, + IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPair(uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPair(uint8_t key_index); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBegin(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *chunk, + uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdate(IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEnd(VAR uint16_t *sig_len); + + /** + * @brief This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignature(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *plain_data, + uint16_t plain_data_len, VAR uint16_t *sig_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Finally, to get a signature, you have to call JCAppGetSignature(). + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior calling of this function you have to be logged in with an User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig Pointer to an array of “sig_len” bytes length. Value of the “sig_len” you've got as a parameter of the JCAppSignatureEnd() or JCAppGenerateSignature() functions. You have to allocate those bytes before calling this function. + * @param sig_len Length of the allocated bytes in a sig array. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetSignature(OUT uint8_t *sig, uint16_t sig_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObj(uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, uint8_t id_size); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubject(uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Using this function you can delete certificate objects from a card. + * + * This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCert(uint8_t obj_type, uint8_t obj_index); + + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjId(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubject(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObj(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + /** + * + * @ingroup Card_Tag_JavaCardApplication + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + c_string DL_API JCAppGetErrorDescription(UFR_STATUS apdu_error_status); + + /** + * @brief This function is used to login to the JCApp with an appropriate PIN code. + * + * Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. JCAppGetPinTriesRemaining Function description This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. This function have parameter of the type dl_sec_code_t which is defined as: typedef enum { USER_PIN = 0, SO_PIN, USER_PUK, SO_PUK } dl_sec_code_t; + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLogin(uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemaining(dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t. + * + * Which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code. + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChange(dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief This function is used to unblock PIN code which is specified by the SO parameter. + * + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblock(uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKey(uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, OUT uint8_t *exponent, + VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKey( + uint8_t key_index, OUT uint8_t *keyW, + VAR uint16_t *keyWSize, // when keyW == NULL, returns size + OUT uint8_t *field, VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, VAR uint16_t *g_size, + OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBits(uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + //------------------------------------------------------------------------------ + /** + * @brief This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. + * + * Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list_size ointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSize(VAR uint32_t *list_size); + + /** + * @brief After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFiles(OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief This function returns file size indexed by the parameter card_file_index, on successful execution. + * + * Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file which size we want to get. + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSize(uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFile(uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief This function reads a file from the DLStorage card directly to the new file on the host file-system. + * + * If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. + * + * Parameter data_size defines the amount of data to be written in the file on the DLStorage card. + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFile(uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief This function writes file content from the host file-system to the new file on the DLStorage card. + * + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief After successful call to this function, the file on the DLStorage card will be deleted. + * + * Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFile(uint8_t file_index); + //------------------------------------------------------------------------------ + /** + * @brief This function is used to get hash output length in bytes for specified hash algorithms. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator for which we want to get output length in bytes. Use values declared in E_HASH_ALGS enumeration. + * @param out_byte_len After successful function execution, the variable on which this pointer points to, will contain output hash length in bytes for specified hash algorithm. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashOutputByteLength(uint32_t hash_algo, VAR uint32_t *out_byte_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions) + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHash(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, OUT uint8_t *hash, uint32_t hash_alocated); + + /** + * @brief This function calculates and returns the hash of the data in the buffer pointed by the “in” function parameter. + * + * Hash algorithm is specified by the hash_algo function parameter. + * If output bytes don't match with hash_alocated function parameter function returns CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH status. + * GetHashToHeap() automatically allocates memory, which *hash parameter will point to after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used for calculation. Use values declared in E_HASH_ALGS enumeration. + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions). + * @param hash After successful function execution, the variable on which this pointer points to, will contain the pointer to the output hash. + * @param hash_len After successful function execution, the variable on which this pointer points to, will contain output hash length. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashToHeap(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, VAR uint8_t **hash, VAR uint32_t *hash_len); + + /** + * @brief This function is used in conjunction with DLHashUpdateChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() has to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used in the following hashing sequence. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashInitChunked(uint32_t hash_algo); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param in One of the chunks of data of which hash is calculated. + * @param in_len Chunk length in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashUpdateChunked(IN const uint8_t *in, uint32_t in_len); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunked(OUT uint8_t *hash, uint32_t hash_alocated); + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * DLHashFinishChunkedToHeap() automatically allocates memory, which *hash parameter will point to, after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunkedToHeap(OUT uint8_t **hash, VAR uint32_t *hash_alocated); + + /** + * @brief This function is used to verify the digital signature of the pre-hashed value or some relatively short plain text message. + * + * If there is no errors during the verification process and digital signature correspond to the "To Be Signed" (TBS) data array and public cryptographic key, the function returns UFR_OK status. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * In case of wrong digital signature, function returns CRYPTO_SUBSYS_WRONG_SIGNATURE status. + * Function can return following status codes in case of various errors: + * * CRYPTO_SUBSYS_NOT_INITIALIZED + * * CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS + * * CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS + * * CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE + * * CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR + * For digest_alg use one of the values declared in E_SIGNER_DIGESTS enumeration: + * enum E_SIGNER_DIGESTS { + * ALG_NULL = 0, + * ALG_SHA, + * ALG_SHA_256, + * ALG_SHA_384, + * ALG_SHA_512, + * ALG_SHA_224, + * ALG_SHA_512_224, + * ALG_SHA_512_256, + * SIG_DIGEST_MAX_SUPPORTED + * }; + * ALG_SHA is the designator for the SHA-1 algorithm. + * For padding_alg use one of the values declared in E_SIGNER_RSA_PADDINGS enumeration: + * enum E_SIGNER_RSA_PADDINGS { + * PAD_NULL = 0, + * PAD_PKCS1_V1_5, + * PAD_PKCS1_PSS, + * SIG_PAD_MAX_SUPPORTED + * }; + * PAD_PKCS1 is an alias of the PAD_PKCS1_V1_5 padding algorithm: + * #define PAD_PKCS1 PAD_PKCS1_V1_5 + * For cipher_alg use one of the values declared in E_SIGNER_CIPHERS enumeration: + * enum E_SIGNER_CIPHERS { + * SIG_CIPHER_RSA = 0, + * SIG_CIPHER_ECDSA, + * SIG_CIPHER_MAX_SUPPORTED + * }; + * When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * + * @ingroup Card_Tag_CardFeatures_DigitalSignatureVerification + * + * @param digest_alg in the E_SIGNER_DIGESTS enumeration. + * @param padding_alg in the E_SIGNER_RSA_PADDINGS enumeration. When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * @param cypher_alg in the E_SIGNER_CIPHERS enumeration. tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * @param tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param signature Pointer to the signature array. + * @param signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. + * @param sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). + * @param pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. + * @param pub_key_params_len Length of the additional public key parameters (in bytes). + * + * @return Operation status + */ + UFR_STATUS DL_API DigitalSignatureVerifyHash(uint32_t digest_alg, uint32_t padding_alg, uint32_t cypher_alg, IN const uint8_t *tbs, + uint32_t tbs_len, IN const uint8_t *signature, uint32_t signature_len, + IN const void *sig_params, uint32_t sig_params_len, IN const uint8_t *pub_key, + uint32_t pub_key_len, IN const void *pub_key_params, uint32_t pub_key_params_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetHashName(uint32_t hash_algo); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the ECC curve designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param eccCurve ECC curve designator. Use values declared in E_ECC_CURVES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetEccCurveName(uint32_t eccCurve); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the signature scheme (signature algorithm) designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param signatureScheme Signature scheme (signature algorithm) designator. Use values declared in E_SIGNATURE_SCHEMES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetSignatureSchemeName(uint32_t signatureScheme); + + /** + * @brief Release the memory allocated from some of the library functions previously called making it available again for further allocations. + * + * Use to deallocate i.e. cleanup memory on the heap allocated. This function is a so-called helper for programming languages other than C/C++ where you can use a free(ptr) instead. Use only after calling the library functions for which it is explicitly indicated in this manual. Function returns nothing. After successful function execution ptr will point to NULL. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param ptr Pointer to the memory allocated on the heap which you want to release. If ptr does not point to a block of memory allocated with the library functions, it causes undefined behavior. If ptr is NULL, the function does nothing. Digital signature verification Enumerations, types and structures for use with DigitalSignatureVerifyHash function enum E_ECC_CURVE_DEFINITION_TYPES { ECC_CURVE_INDEX, ECC_CURVE_NAME, ECC_CURVE_DOMAIN_PARAMETERS, ECC_CURVE_DEFINITION_TYPES_NUM }; + * + */ + void DL_API DLFree(void *ptr); + //------------------------------------------------------------------------------ + /** + * @brief Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBac(IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], + VAR uint64_t *send_sequence_cnt); + + /** + * @brief Use this function to read files from the eMRTD NFC tag. + * + * You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param file_index Parameter that specifies the file we want to read from the eMRTD. This is a pointer to byte array containing exactly two bytes designating eMRTD file. Those two bytes are file identificator (FID) and there is a list of FIDs: EF.COM = {0x01, 0x1E} EF.DG1 = {0x01, 0x01} EF.DG2 = {0x01, 0x02} EF.DG3 = {0x01, 0x03} EF.DG4 = {0x01, 0x04} EF.DG5 = {0x01, 0x05} EF.DG6 = {0x01, 0x06} EF.DG7 = {0x01, 0x07} EF.DG8 = {0x01, 0x08} EF.DG9 = {0x01, 0x09} EF.DG10 = {0x01, 0x0A} EF.DG11 = {0x01, 0x0B} EF.DG12 = {0x01, 0x0C} EF.DG13 = {0x01, 0x0D} EF.DG14 = {0x01, 0x0E} EF.DG15 = {0x01, 0x0F} EF.DG16 = {0x01, 0x10} EF.SOD = {0x01, 0x1D} + * @param output After the successful call to this function, this pointer will point to the pointer on the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated during function execution. Maximum amount of data allocated can be 32KB. There is a programmer responsibility to cleanup allocated data (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * @param output_length After the successful call to this function, this pointer is pointed to the size of the file data read from an eMRTD file specified by the file_index parameter. + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeap(IN const uint8_t file_index[2], VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief This function validates data groups read from the eMRTDocument. + * + * All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function.\ + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidate(IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, uint32_t verbose_level, + OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, you can call this function and pass it null terminated strings containing document number, document holder date of birth and document expiration date. + * + * After successful function execution MRZ Proto Key will be stored in a mrz_proto_key 25-byte array. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number Pointer to a null terminated string containing exactly 9 characters document number. + * @param date_of_birth Pointer to a null terminated string containing exactly 6 characters representing the date of birth in the “YYMMDD” format. + * @param date_of_expiry Pointer to a null terminated string containing exactly 6 characters representing expiration date in the “YYMMDD” format. + * @param mrz_proto_key This byte array will contain a calculated MRZ proto-key after successful function execution. This array must have allocated at least 25 bytes prior to calling this function. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_MRZDataToMRZProtoKey(IN const char *doc_number, IN const char *date_of_birth, IN const char *date_of_expiry, + OUT uint8_t mrz_proto_key[25]); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, in the case of the TD3 MRZ format (88 totally character long), you can call this function and pass it a null terminated string containing the MRZ subjacent row. + * + * Example of the TD3 MRZ format printed on the eMRTD document looks like this: + * P File 2, and overwrites the contents with data provided + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param data Array containing NDEF message data stored in a buffer to be written + * @param data_length length of the data to be written + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFMessage(IN uint8_t *data, uint32_t data_length); + + /** + * @brief Function used to read the whole NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param message pointer to array that will hold message data + * @param message_length length of the message that was read if successfull + * + * @return Operation status + */ + + UFR_STATUS DL_API uFR_int_DesfireReadNDEFMessage(OUT uint8_t* message, uint32_t *message_length); + /** + * @brief Function used to extract the payload of the NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param payload_str pointer to buffer that will hold payload data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadNDEFPayload(OUT char* payload_str); + + /** + * @brief Function used to write the payload of the NDEF message on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * The function takes in only c-string URI, and sets it's uri_identifier to 0 so it is not prefixed by anything when read. + * + * @param payload_str pointer to buffer that will hold message data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFPayload(IN c_string payload_str); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief The function allows the blinking of the green diode independently of the user's signaling command (default setting). + * + * This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOn(void); + + /** + * @brief The function prohibits the blinking of the green diode independently of the user's signaling command. + * + * LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOff(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOn(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOff(void); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeA(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeB(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212Default(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424Default(void); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeA(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeB(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t CWGsNOff, + uint8_t ModGsNOff); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API FastFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParameters(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrate(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersPN7462(OUT uint8_t *die_id, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, VAR uint8_t *fw_ver_build); + + // SAM + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_raw(OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version(VAR SAM_HW_TYPE *sam_type, OUT uint8_t *sam_uid); + + /** + * @brief Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_raw(uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param key_no key_no + * @param key_v key_v + * @param des_key des_key + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_des(uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * @ingroup UNDOCUMENTED + * + * @param aes_key_ver_a aes_key_ver_a + * @param ver_a ver_a + * @param aes_key_ver_b aes_key_ver_b + * @param ver_b ver_b + * @param aes_key_ver_c aes_key_ver_c + * @param ver_c ver_c + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_key(IN uint8_t *aes_key_ver_a, uint8_t ver_a, IN uint8_t *aes_key_ver_b, + uint8_t ver_b, IN uint8_t *aes_key_ver_c, uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param master_aes_key master_aes_key + * @param key_version key_version + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_mode(IN uint8_t *master_aes_key, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. + * + * A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plain(IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *keyA, IN uint8_t *keyB, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Ultralight C card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 8 bytes of DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_key(uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + uint8_t sam_lock_unlock, uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKey(uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeable(void); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfReset(void); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOn(void); + + /** + * @brief Function switch off RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderId(IN uint8_t *reader_id); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReader(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderUsb(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderStreamUsb(IN uint8_t *data, uint16_t packet_nr); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BootReader(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_CodeProtect(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParams(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParamsUsb(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_Test(uint8_t param); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdCalibration(uint8_t lpcd_threshold, OUT uint16_t *lpcd_reference); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdPerform(uint8_t lpcd_threshold, uint16_t lpcd_reference, VAR uint16_t *lpcd_agc, VAR uint8_t *lpcd_status); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOn(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ExtField(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ESP32_boot_init(IN uint8_t *reader_cnt, uint8_t reader_nr); + + // MIFARE PLUS + /** + * @brief Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePerso(uint16_t address, IN uint8_t *data); + + /** + * @brief Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPerso(void); + + /** + * @brief Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param card_master_key card_master_key + * @param card_config_key card_config_key + * @param level_2_switch_key level_2_switch_key + * @param level_3_switch_key level_3_switch_key + * @param level_1_auth_key level_1_auth_key + * @param select_vc_key select_vc_key + * @param prox_chk_key prox_chk_key + * @param vc_poll_enc_key vc_poll_enc_key + * @param vc_poll_mac_key vc_poll_mac_key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimal(IN uint8_t *card_master_key, IN uint8_t *card_config_key, IN uint8_t *level_2_switch_key, + IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, IN uint8_t *select_vc_key, + IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key); + + /** + * @brief Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current master key *new key pointer to 16 byte array containing the new master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new master key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new configuration key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) *configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PK(IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKey(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Key B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key_index new_key_index + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index, uint8_t new_key_type); + + /** + * @brief + * ADD DESCRIPTION + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param old_key old_key + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * @brief Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKey(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PK(IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key_index pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief + * Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PK(IN uint8_t *key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceGet(uint32_t auth_mode, IN void *auth_value, VAR int32_t *credit); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceSet(uint32_t auth_mode, IN void *auth_value, int32_t credit); + + /** + * @brief This function sets communication speed (UART baud rate). + * + * Allowed values of baud rate are: 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, and 1000000 bps. All RS232 devices are supported, and USB devices (Nano FR, Classic) from firmware version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param baud_rate UART baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API SetUartSpeed(uint32_t baud_rate); + + /** + * @brief This function returns communication speed (UART baud rate) to default value. + * + * For RS23 devices default communication speed is 115200 bps, and for USB devices is 1000000 bps. + * For RS232 devices from version 5.0.1 (plus devices), and for USB devices from version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 1 - USB 2 - RS232 + * @param comm_type 1 - COM port 2 - FTDI + * @param port_name If comm_type is FTDI enter empty string If comm_type is COM port Windows “COMx” Linux “/dev/ttyUSBx” Mac OS “/dev/tty.usbserial-xxxxxxxx” + * + * @return Operation status + */ + UFR_STATUS DL_API SetDefaultUartSpeed(uint8_t reader_type, uint8_t comm_type, IN c_string port_name); + + // NT4H + /** + * @brief Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. + * + * This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parameters(uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Provided Key mode (PK) The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit read_ctr_limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Provided Key mode (PK) Function enables card Random ID. + * + * Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pk(IN uint8_t *aes_key_ext); + UFR_STATUS DL_API nt4h_unset_rid_pk(IN uint8_t *aes_key_ext); + + /** + * @brief Function enables card Random ID. Authentication with application master key (key number 0) required. + * + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid(uint8_t aes_key_no); + + /** + * @brief Provided Key mode (PK) Function returns card UID if Random ID activated. + * + * Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid(uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Provided Key mode (PK) Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pk(IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key(uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Provided Key mode (PK) Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pk(IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr(uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief No authentication. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_auth(uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Helper function for the MAC of SDM checking. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param mac_in_data data from mac_input_offset to mac_offset + * @param mac_in_len mac_input_offset - mac_offset + * @param sdm_mac pointer to array contained 8 bytes SDM MAC + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_check_sdm_mac(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *mac_in_data, IN uint8_t mac_in_len, IN uint8_t *sdm_mac); + + /** + * @brief Helper function for decryption of encrypted file data. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param enc_file_data pointer to array contained encrypted part of file data + * @param enc_file_data_len length of encrypted part of file data + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_sdm_enc_file_data(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *enc_file_data, IN uint8_t enc_file_data_len); + + /** + * @brief Helper function for decryption of encrypted PICC data. + * + * Function returns UID and SDM reading counter. Users need to know the AES key for metadata read (PICC data). + * + * @ingroup Card_Tag_NT4H + * + * @param picc_data pointer to array contained encrypted PICC data + * @param auth_key pointer to array contained AES meta data read key + * @param picc_data_tag if bit 7 set exist UID mirroring if bit 6 set exist SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param smd_read_cnt pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_picc_data(IN uint8_t *picc_data, IN uint8_t *auth_key, IN uint8_t *picc_data_tag, IN uint8_t *uid, IN uint32_t *smd_read_cnt); + + /** + * Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature(uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pk(IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status(uint8_t aes_key_no, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_auth(VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pk(IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt(uint8_t aes_key_no, uint8_t tt_status_key_no); + + // Desfire light + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param file_type file type 0 - standard data file, 2 - value file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param free_get_value value file get value without authentication (0 - disabled, 1 - enabled) + * @param record_size cyclic record file size of record + * @param max_number_of_rec cyclic record file maximal number of record + * @param curr_number_of_rec cyclic record file number of used record + * @param ex_unauth_operation TMC file exclude unauthorized operation + * @param tmc_limit_conf TMC file limit configuration + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param tmc_limit TMC file counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, VAR uint8_t *free_get_value, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *ex_unauth_operation, VAR uint8_t *tmc_limit_conf, VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, VAR uint32_t *tmc_limit); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered read_key_no read key number (0 - 4) write_key_no write key number (0 - 4) read_write_key_no read write key number (0 - 4) change_key_no change key number (0 - 4) + * @param key_no DESCRIPTION + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no currnent change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Function changes file settings of the Transaction MAC file. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no aes_key_no + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * @ingroup UNDOCUMENTED + * + * @param aes_key_ext aes_key_ext + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * @brief + * From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pk(IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file(uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in credit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of credit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_credit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in debit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of debit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_debit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in clear record operation. Function also returns decrypted Previous Reader ID. Users must enter file number, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_clear_record_transaction_mac(uint8_t file_no, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + // reader + /** + * @brief Function returns various reader states. + * + * From library version 5.0.31 and firmware version 5.0.33 + * The reader states are defined into following structures. This function is useful for checking if the reader is still in emulation mode after calling the TagEmulationStartRam() function. + * typedef enum E_EMULATION_MODES { + * TAG_EMU_DISABLED, + * TAG_EMU_DEDICATED, + * TAG_EMU_COMBINED, + * TAG_EMU_AUTO_AD_HOC + * }emul_modes_t; + * typedef enum E_EMULATION_STATES + * { + * EMULATION_NONE, + * EMULATION_IDLE, + * EMULATION_AUTO_COLL, + * EMULATION_ACTIVE, + * EMULATION_HALT, + * EMULATION_POWER_OFF + * }emul_states_t; + * typedef enum E_PCD_MGR_STATES + * { + * PCD_MGR_NO_RF_GENERATED, + * PCD_MGR_14443A_POLLING, + * PCD_MGR_14443A_SELECTED, + * PCD_MGR_CE_DEDICATED, + * PCD_MGR_CE_COMBO_START, + * PCD_MGR_CE_COMBO, + * PCD_MGR_CE_COMBO_IN_FIELD + * }pcd_states_t; + * + * @ingroup Miscellaneous + * + * @param state - normal working mode states are PCD_MGR_NO_RF_GENERATED or PCD_MGR_14443A_POLLING or PCD_MGR_14443A_SELECTED. - NTAG emulation mode state is PCD_MGR_CE_DEDICATED emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderStatus(VAR pcd_states_t *state, VAR emul_modes_t *emul_mode, VAR emul_states_t *emul_state, VAR uint8_t *sleep_mode); + + // EMV FUNCTIONS + + /** + * @brief Used for extracting the credit card PAN number. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param pan_str Pointer to char array containing credit card PAN. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetPAN(IN c_string df_name, OUT char *pan_str); + + /** + * @brief Used for extracting details about the last transaction stored in a credit card. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param last_transaction_info Pointer to char array containing details about the last transaction stored in the card. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetLastTransaction(IN c_string df_name, OUT char *last_transaction_info); + + + /** + * @brief Function is used for extracting image pixel values and storing them in the display for later use. This function will not render the image to the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param gallery_index - where in displays memory to store the bitmap(0-10) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveBitmapToGallery(const char* filename, int gallery_index); + + /** + * @brief Function takes an image and extracts it's pixel values and then just renders the on the display without storing the bitmap in the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param positionX - where on the display to start the bitmap. + * @param positionY - where on the display to start the bitmap. + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmap(const char* filename, int positionX, int positionY); + + /** + * @brief Function renders an image that is stored in the display gallery. The gallery consist of 15 slots, of those 15 - 10 are used for storing bitmaps and the other 4 (11-15) are SystemBitmaps used by the display. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param gallery_index - which slot from the gallery to render on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmapFromGallery(int gallery_index); + + /** + * @brief Function allows you to change the essential symbols that the display regularly uses. These symbols include the Boot Image (ID-15), the Check bitmap(ID-14), and the Cross bitmap (ID-13). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param system_bitmap_index - ID of which system bitmap to change or import new (if slot is free 11-12) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveSystemBitmap(const char* filename, int system_bitmap_index); + + /** + * @brief Function renders the last image that was called with the function Display_ShowBitmap() + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowLastUnsavedImage(); + + /** + * @brief Function is used for communicating with the uFR device via I2C in COM protocol format. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param cmd - Command packet (read the "COM protocol" for more information) + * @param cmd_ext - Command extended packet, if cmd_ext is not being sent then should be "NULL" + * @param rsp - Array where the response will be written (at least 7 bytes) + * @return Operation status + */ + UFR_STATUS DL_API Display_Transmit(uint8_t *cmd, uint8_t *cmd_ext, uint8_t *rsp); + + /** + * @brief Function displays custom text on the screen. It can also enable text scrolling, position the text at a specific location on the display, and adjust the font size and style + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param customText - pointer to a string text + * @param fontStyle - number to change font style (0-1; 0 - default; 1 - not implemented) + * @param fontSize - number to change font size (0-1; 0 - 8x8 pixels; 1 - 16x16 pixels) + * @param scrollEnable - number to enable scroll (0-1) + * @param positionX - number containing X cordinate to place the text + * @param positionY - number containing Y cordinate to place the text + * @return Operation status + */ + UFR_STATUS DL_API Display_PrintText(const char* customText, int fontStyle, int fontSize, int scrollEnable, int positionX, int positionY); + + /** + * @brief Function displays a chec or a cross bitmap and, if a speaker is connected to the display, it triggers a function that produces a beep sound + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param signal - number to display a check or a cross symbol on the display (1-2; 1-cross; 2-check) + * @return Operation status + */ + UFR_STATUS DL_API Display_UserInterfaceSignal(int signal); + + /** + * @brief Function writes the time on the display. If the display is not connected to the Reader, the time will be displayed and remain unchanged. However, if the display is connected to the Reader, the time will be shown only for a second because the Reader is sending the correct time to the display every second. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param hour - number that represetns the hour that will be drawn on the display + * @param minute - number that represetns the minute that will be drawn on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowTime(int hour, int minute); + + /** + * @brief Function clears a specified section of the display. If xPosEND or yPosEND are set to 0, the function will automatically assume that the end postion for erasing extends to the edge of the screen (i.e., xPosEND will default to the display's maximum width, and yPosEND will default to it's maximum height). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param xPos - number containing X coordinate to clear on the display, start position + * @param xPosEND - number containing X coordinate to clear on the display, end position + * @param yPos - number containing Y coordinate to clear on the display, start position + * @param yPosEND - number containing Y coordinate to clear on the display, end position + * @return Operation status + */ + UFR_STATUS DL_API Display_EraseSection(int xPos,int xPosEND,int yPos,int yPosEND); + + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + // XXX: Support for multiple readers with same DLL + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + + //-------------------------------------------------------------------------------------------------- + + ///--------------------------------------------------------------------- + /** + * @brief This is the first function in the order for execution for the multi-reader support. + * The function prepares the list of connected uF-readers to the system and returns the number of list items - number of connected uFR devices. + * ReaderList_UpdateAndGetCount() scans all communication ports for compatible devices, probes open readers if still connected, if not close and marks their handles for deletion. If some device is disconnected from the system this function should remove its handle. + * As of uFCoder version 5.0.73, this function probes both FTDI & COM devices and tries to open them. + * Each call to this method will close previously opened devices by this function, scan, and open everything found. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param NumberOfDevices how many compatible devices are connected to the system + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_UpdateAndGetCount(VAR int32_t *NumberOfDevices); + + /** + * @brief Used to retrieve information about a reader found & connected via ReaderList_UpdateAndGetCount(). + * This should be executed for each device based on number of devices found, providing valid index. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex index of the device in the readers list + * @param DeviceHandle assigned Handle + * @param DeviceSerialNumber device serial number + * @param DeviceType device type - device identification in AIS database + * @param DeviceFWver version of firmware + * @param DeviceCommID device identification number (master) + * @param DeviceCommSpeed communication speed + * @param DeviceCommFTDISerial FTDI COM port identification + * @param DeviceCommFTDIDescription FTDI COM port description + * @param DeviceIsOpened is Device opened + * @param DeviceStatus actual device status + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetInformation( // + uint32_t DeviceIndex, // index of the device to get information from + VAR UFR_HANDLE *DeviceHandle, //// assigned Handle + OUT c_string *DeviceSerialNumber, //// device serial number + VAR int *DeviceType, //// device type - device identification in AIS database + OUT c_string *DeviceFWver, //// version of firmware + VAR int *DeviceCommID, //// device identification number (master) + VAR int *DeviceCommSpeed, //// communication speed + OUT c_string *DeviceCommFTDISerial, //// FTDI COM port identification + OUT c_string *DeviceCommFTDIDescription, //// FTDI COM port description + VAR int *DeviceIsOpened, //// is Device opened + VAR int *DeviceStatus //// actual device status + ); + + /** + * @brief Force handle deletion when you identify that the reader is no longer connected, and want to release the handle immediately. If the handle exists in the list of opened devices, function would try to close communication port and destroy the handle. + * When uFR reader is disconnected, ReaderList_UpdateAndGetCount() will do that (destroy) automatically in next execution. + * + * @param DeviceHandle The handle that will be destroyed + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Destroy(UFR_HANDLE *DeviceHandle); + + /** + * @brief This method is used for manual addition of uFR devices to the list. Parameters used are the same as in ReaderOpenEx() method. Use this method if the device was not previously discovered by the ReaderList_UpdateAndGetCount() method. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceHandle the handle that will be assigned for interacting with the specified reader on success. + * @param reader_type Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_name Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_interface Refer to ReaderOpenEx() for detailed description of this parameter. arg Refer to ReaderOpenEx() for detailed description of this parameter. + * @param arg Refer to ReaderOpenEx() for detailed description of this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Add(UFR_HANDLE *DeviceHandle, uint32_t reader_type, + c_string port_name, uint32_t port_interface, void *arg); + + /** + * @brief Tries to re-open the device based on the serial number of the device. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param hndUFR handle of the uFR device + * @param Device_SN Serial number of the device contained as char array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenBySerial(VAR UFR_HANDLE *hndUFR, const char Device_SN[16]); + + // XXX: Obsolete functions - remain for backward compatibility + /** + * @brief + * Gets reader’s reader serial number as a pointer to 4 byte value, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulSerialNumber Contains reader serial number as a 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialByIndex(int32_t DeviceIndex, VAR uint32_t *lpulSerialNumber); + + /** + * @brief Gets reader’s descriptive name as a array of 8 chars, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param pSerialDescription Contains reader serial number as array of 8 chars + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialDescriptionByIndex(int32_t DeviceIndex, OUT uint8_t pSerialDescription[8]); + + /** + * @brief Gets devices reader type based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulReaderType Contains reader type as 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetTypeByIndex(int32_t DeviceIndex, VAR uint32_t *lpulReaderType); + + /** + * @brief Gets devices FTDI serial port number based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Serial Contains FTDI serial number as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDISerialByIndex(int32_t DeviceIndex, OUT char **Device_Serial); + + /** + * @brief Gets devices FTDI description based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Description FTDI description as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDIDescriptionByIndex(int32_t DeviceIndex, OUT char **Device_Description); + + /** + * @brief Tries to re-open the device based on the device index. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenByIndex(const int32_t DeviceIndex, VAR UFR_HANDLE *hndUFR); + + //-------------------------------------------------------------------------------------------------- + + // open first/next Reader and return handle - better to use ReaderList_OpenByIndex() + /** + * @brief Multi reader support. Open reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s, or if you have only one reader attached to another power supply (not your PC) it will open that reader based on it’s working mode (TCP or UDP). If you have more than one µFR Online device, ReaderOpen function will open the first one found, for opening another device, use ReaderOpenEx instead. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenM(VAR UFR_HANDLE *hndUFR); + +#ifdef ESP_PLATFORM + /** + * @brief @param hndUFR handle of the uFR device + * @param port_num + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderOpenM(UFR_HANDLE *hndUFR, uint8_t port_num, uint8_t tx_pin, uint8_t rx_pin, uint8_t reset_pin, uint16_t baud_rate); + UFR_STATUS DL_API BootReaderM(UFR_HANDLE hndUFR); + UFR_STATUS DL_API ProgReaderM(UFR_HANDLE hndUFR ,uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, uint8_t *crc_ok); + UFR_STATUS DL_API PN7462_WriteParamsM(UFR_HANDLE hndUFR , uint8_t *aes_key, uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, uint8_t *dev_type, uint8_t production); +#endif + + /** + * @brief Multi reader support. Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderCloseM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTypeM(UFR_HANDLE hndUFR, IN uint32_t *lpulReaderType); + + /** + * @brief Multi reader support. Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumberM(UFR_HANDLE hndUFR, IN uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnectedM(UFR_HANDLE hndUFR, VAR uint32_t *connected); + + /** + * @brief Multi reader support. Store a new key or change existing key under provided index parameter.The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Multi reader support. Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. This function turns sound and light reader signals. Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignalM(UFR_HANDLE hndUFR, uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Multi reader support. From version 5.0.68. + * Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolumeM(UFR_HANDLE hndUFR, uint8_t sound_volume); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExtM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExtM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @param hndUFR handle of the uFR device + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * Multi reader support. From library version 5.0.36 and firmware version 5.0.37 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSakM(UFR_HANDLE hndUFR, uint16_t *atqa, uint8_t *sak); + + /** + * @brief Multi reader support. Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authenticationwith key A or key B:use KeyA - MIFARE_AUTHENT1A = 0x60or KeyB - MIFARE_AUTHENT1B = 0x61For NTAG 21x, Ultralight EV1 and other T2T tags supportingPWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead()or LinearRead_PK() functions. Value 0x60 with LinearRead() orLinearRead_PK() functions means “without PWD_AUTH“ and in thatcase you can send for ucReaderKeyIndex or aucProvidedKeyparameters anything you want without influence on the result. ForNTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTHyou can use _AKM1 or _AKM2 function variants only withoutPWD_AUTH in any case of the valid values (0x60 or 0x61) providedfor this parameter.For Mifare Plus tags (PK mode) defines whether to performauthentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCardM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKeyM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafeM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode)For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters + + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using absolute Block address. + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PKM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * Multi reader support. + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Multi reader support. Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + // New commands (for RTC & I2C EEPROM): + /** + * @brief Multi reader support. Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTimeM(UFR_HANDLE hndUFR, VAR uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into the device's RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password time + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTimeM(UFR_HANDLE hndUFR, IN uint8_t *password, VAR uint8_t *time); + + /** + * @brief Multi reader support. This function is used in Common, Advance and Access Control set of functions. + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPasswordM(UFR_HANDLE hndUFR, IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM. Maximal length of array is 128 bytes. Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWriteM(UFR_HANDLE hndUFR, IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescriptionM(UFR_HANDLE hndUFR, OUT uint8_t pSerialDescription[8]); + + // New since version 2.0: + /** + * @brief Multi reader support. Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumberM(UFR_HANDLE hndUFR, VAR uint8_t *build); + + /** + * @brief Multi reader support. This function returns UID of card actually present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief Multi reader support. This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi card mode: + //------------------------------------------------------------------------------ + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCardsM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + + /** + * @brief Multi reader support. Before calling this function you have to call EnumCards() first. + * For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCardsM(UFR_HANDLE hndUFR, OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + + /** + * @brief Multi reader support. Selects one of the cards which UID is on the actual UID list of the enumerated cards. If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCardM(UFR_HANDLE hndUFR, IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief Multi reader support. If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCardM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatusM(UFR_HANDLE hndUFR, VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns card type according to DlogicCardType enumeration. For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardTypeM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType); + + /** + * @brief Multi reader support. This function returns 8 bytes of the T2T version. All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersionM(UFR_HANDLE hndUFR, OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Multi reader support. Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpulLinearSize pointer to variable which contain size of user data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSizeM(UFR_HANDLE hndUFR, VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * Multi reader support. From library version 5.0.59 and firmware version 5.0.60 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatusM(UFR_HANDLE hndUFR, OUT uint8_t *tt_message, VAR uint8_t *tt_status); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @param hndUFR handle of the uFR device + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @ingroup Card_Tag_M + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalDataM(UFR_HANDLE hndUFR, uint8_t data[32], uint32_t *len); + + /** + * @brief Multi reader support. Function returns reader’s serialized discovery loop structure i.e. C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetupM(UFR_HANDLE hndUFR, uint8_t *setupStruct, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoopM(UFR_HANDLE hndUFR, const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Multi reader support. Function returns the AID set in the reader to retrieve the mobile phone's unique ID. If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAidM(UFR_HANDLE hndUFR, uint8_t *aid, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAidM(UFR_HANDLE hndUFR, const uint8_t *aid, uint32_t len); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfigM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtpM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlotM(UFR_HANDLE hndUFR, uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKeyM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencryptedM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZoneM(UFR_HANDLE hndUFR, uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZoneM(UFR_HANDLE hndUFR, uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatusM(UFR_HANDLE hndUFR, VAR uint8_t *bool_config_zone_locked, + VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevisionM(UFR_HANDLE hndUFR, uint8_t revision[4]); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProModeM(UFR_HANDLE hndUFR, VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProModeM(UFR_HANDLE hndUFR, const uint32_t ReaderProMode); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_InitializeM(UFR_HANDLE hndUFR, IN const uint8_t *TBSerialString, uint16_t job_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCardM(UFR_HANDLE hndUFR, const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextM(UFR_HANDLE hndUFR, const uint32_t code_type, const uint32_t from_timestamp, + const uint32_t to_timestamp, const uint32_t additional_data_size, + IN const uint8_t additional_data[], VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSNM(UFR_HANDLE hndUFR, OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSNM(UFR_HANDLE hndUFR, VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSNM(UFR_HANDLE hndUFR, OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Multi reader support. Function returns TNF, type of record, ID and payload from the NDEF record. NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Multi reader support. Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, uint8_t *type_length, + IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, uint32_t *payload_length, + VAR uint8_t *card_formated); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroringM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_ttM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_countM(UFR_HANDLE hndUFR, VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, + OUT uint8_t *ndef_record_array, VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Multi reader support. Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_recordsM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initializationM(UFR_HANDLE hndUFR); + + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + + /** + * @brief Multi reader support. Function stores a message record for NTAG emulation mode into the reader. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefM(UFR_HANDLE hndUFR, uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, + uint8_t id_length, IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief Multi reader support. Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function returns current ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParamsM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. This command set ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParamsM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param is_field_present contains 0 if external field isn’t present or 1 if field is present. + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldStateM(UFR_HANDLE hndUFR, VAR uint8_t *is_field_present); + + /** + * @brief Multi reader support. Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. From library version 5.0.31, and firmware version 5.0.33 + * Function stores a message record for NTAG emulation mode into the reader in the RAM. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRamM(UFR_HANDLE hndUFR, uint8_t tnf, uint8_t *type_record, uint8_t type_length, + uint8_t *id, uint8_t id_length, uint8_t *payload, uint32_t payload_length); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking_M + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureM(UFR_HANDLE hndUFR, IN uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], + VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExtM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief Multi reader support. This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, uint32_t inc_value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successfulfunction execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterM(UFR_HANDLE hndUFR, VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RKM(UFR_HANDLE hndUFR, VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PKM(UFR_HANDLE hndUFR, VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Multi reader support. Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode sets idle mode value + * @param card_detection_mode sets card detection mode value + * @param idle_color sets idle color + * @param card_detection_color sets card detection color + * @param enabled value that enables it (1) or disables it (0) + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode returns idle mode value + * @param card_detection_mode returns card detection mode value + * @param idle_color returns idle color + * @param card_detection_color returns card detection color + * @param enabled returns 1 if enabled, 0 if disabled + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_numberM(UFR_HANDLE hndUFR, VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, VAR uint8_t *start_minute, + VAR uint8_t *end_hour, VAR uint8_t *end_minute, OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_recordM(UFR_HANDLE hndUFR, uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, + uint8_t begin_hour, uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, + uint8_t end_hour, uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_recordM(UFR_HANDLE hndUFR, VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, + VAR uint8_t *end_month, VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_typeM(UFR_HANDLE hndUFR, uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_typeM(UFR_HANDLE hndUFR, VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_durationM(UFR_HANDLE hndUFR, uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_durationM(UFR_HANDLE hndUFR, VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_durationM(UFR_HANDLE hndUFR, uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_durationM(UFR_HANDLE hndUFR, VAR uint32_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validityM(UFR_HANDLE hndUFR, VAR int32_t *credit, VAR uint32_t *begin_year, + VAR uint32_t *begin_month, VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, VAR uint32_t *end_year, VAR uint32_t *end_month, + VAR uint32_t *end_day, VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validityM(UFR_HANDLE hndUFR, int32_t credit, uint32_t begin_year, uint32_t begin_month, + uint32_t begin_day, uint32_t begin_hour, uint32_t begin_minute, uint32_t end_year, + uint32_t end_month, uint32_t end_day, uint32_t end_hour, uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint8_t *right_record_type, + OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counterM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, + uint16_t last_reader_nr, uint8_t start_hour, uint8_t start_minute, + uint8_t end_hour, uint8_t end_minute, IN uint8_t *days, + uint8_t max_daily_counter); + + //============================================================================= + + /** + * @brief Multi reader support. Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOnM(UFR_HANDLE hndUFR, uint16_t pulse_duration); + + /** + * @brief Multi reader support. Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayStateM(UFR_HANDLE hndUFR, uint8_t state); + + /** + * @brief Multi reader support. Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param intercom shows that there is voltage at the terminals for intercom connection, or not + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoStateM(UFR_HANDLE hndUFR, VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief + * Multi reader support. Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControlM(UFR_HANDLE hndUFR, uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Multi reader support. This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControlM(UFR_HANDLE hndUFR, uint8_t light_status); + + /** + * @brief Multi reader support. For classic uFR PLUS devices only. + * The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.55. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControlM(UFR_HANDLE hndUFR, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.64. + * The function sets color on the RGB diodes. This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleepM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.66. + * The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. Function also sets the number of omitted activity periods, when the RGB light is off. For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriodM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSetM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, uint8_t bad_select_nr_max); + + /** + * @brief Multi reader support. The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, VAR uint8_t *bad_select_nr_max); + + /** + * @brief Multi reader support. Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSetM(UFR_HANDLE hndUFR, uint8_t seconds_wait); + + /** + * @brief Multi reader support. Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGetM(UFR_HANDLE hndUFR, VAR uint8_t *seconds_wait); + + /** + * @brief Multi reader support. This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanentlyM(UFR_HANDLE hndUFR, unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Multi reader support. Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParametersM(UFR_HANDLE hndUFR, VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Multi reader support. Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayDataM(UFR_HANDLE hndUFR, IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Multi reader support. From version 5.0.55 + * Function has the same functionality as the function SetDisplayData. New feature is the RGB port selection. Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief Multi reader support. This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequencyM(UFR_HANDLE hndUFR, uint16_t frequency); + + /** + * @brief Multi reader support. SetRgbIntensity (alias from version 5.0.55) + * Function sets the intensity of light on the display. Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensityM(UFR_HANDLE hndUFR, uint8_t intensity); + + /** + * @brief Multi reader support. GetRgbIntensity (alias from version 5.0.55) + * Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensityM(UFR_HANDLE hndUFR, VAR uint8_t *intensity); + + // ############################################################################# + // ############################################################################# + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_ModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATSM(OUT UFR_HANDLE hndUFR, uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorageM(UFR_HANDLE hndUFR); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceiveM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint32_t *ufr_status); + /** + * @brief Multi reader support. + * Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_TransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, + uint8_t data_out_len, OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, + uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * Sends C–APDU in the c_string (zero terminated) format, containing pairs of the + hexadecimal digits. Pairs of the hexadecimal digits can be delimited by any of the punctuation + characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu C_APDU as string + * @param r_apdu R_APDU returned as string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceiveM(UFR_HANDLE hndUFR, IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief Multi reader support. + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are + sent and receive in the form of the byte arrays. There is obvious need for a c_apdu_len and + *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, + respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, + VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief Multi reader support. + * This is “exploded binary” alternative function intended for support APDU commands in ISO 14443- + 4A tags. APDUTransceive() receives separated parameters which are an integral part of the C– + APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls lcs + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, + uint32_t Nc, OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chainM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceiveM(UFR_HANDLE hndUFR, uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselectM(UFR_HANDLE hndUFR, uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceiveM(UFR_HANDLE hndUFR, uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, + uint8_t crypto1, uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Multi reader support. Function sets the parameters for transceive mode. If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_startM(UFR_HANDLE hndUFR, uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief Multi reader support. + * The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enableM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceiveM(UFR_HANDLE hndUFR, IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, + uint32_t bytes_to_receive, VAR uint32_t *rcv_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interfaceM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_GenericM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDUM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4M(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Using this function you can select the appropriate application on the card. For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAidM(UFR_HANDLE hndUFR, IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief Multi reader support. In JCApp cards you can put two types of asymmetric crypto keys. Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + const IN uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_type key_type + * @param key_index key_index + * @param key_designator key_designator + * @param key_bit_len key_bit_len + * @param params params + * @param params_size params_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPairM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, uint8_t key_designator, + uint16_t key_bit_len, IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBeginM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *chunk, uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdateM(UFR_HANDLE hndUFR, IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Multi reader support. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEndM(UFR_HANDLE hndUFR, VAR uint16_t *sig_len); + + /** + * @brief Multi reader support. + * This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignatureM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *plain_data, uint16_t plain_data_len, VAR uint16_t *sig_len, + IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, + uint8_t id_size); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Multi reader support. + * Using this function you can delete certificate objects from a card. This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCertM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index); + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjIdM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + + /** + * @brief Multi reader support. + * This function is used to login to the JCApp with an appropriate PIN code. Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLoginM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief Multi reader support. This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemainingM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief Multi reader support. This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChangeM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief Multi reader support. + * This function is used to unblock PIN code which is specified by the SO parameter. + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblockM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, + OUT uint8_t *exponent, VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *keyW, VAR uint16_t *keyWSize, OUT uint8_t *field, + VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, + VAR uint16_t *g_size, OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, + VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); // when keyW == NULL, returns size + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBitsM(UFR_HANDLE hndUFR, uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list_size Pointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSizeM(UFR_HANDLE hndUFR, VAR uint32_t *list_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFilesM(UFR_HANDLE hndUFR, OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief Multi reader support. + * This function returns file size indexed by the parameter card_file_index, on successful execution. Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file which size we want to get + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSizeM(UFR_HANDLE hndUFR, uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated d Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief Multi reader support. + * This function reads a file from the DLStorage card directly to the new file on the host file-system. If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. Parameter data_size defines the amount of data to be written in the file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief Multi reader support. + * This function writes file content from the host file-system to the new file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * After successful call to this function, the file on the DLStorage card will be deleted. Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFileM(UFR_HANDLE hndUFR, uint8_t file_index); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBacM(UFR_HANDLE hndUFR, IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], + OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * Use this function to read files from the eMRTD NFC tag. You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param file_index file index + * @param output buffer that storese output + * @param output_length length of the returned output + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt send_sequence_cnt + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *file_index, VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * This function validates data groups read from the eMRTDocument. All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * ________________ + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidateM(UFR_HANDLE hndUFR, IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, + uint32_t verbose_level, OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + // ############################################################################# + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Start(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StartM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Stop(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StopM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Start(void); // Alias for uFR_DESFIRE_Start() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StartM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StartM() + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Stop(void); // Alias for uFR_DESFIRE_Stop() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StopM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StopM() + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUidM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3desM(UFR_HANDLE hndUFR, IN uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Provided Key mode (PK) + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function returns the available bytes on the card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param free_mem_byte pointer to free memory size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFreeMemM(UFR_HANDLE hndUFR, VAR uint32_t *free_mem_byte, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCardM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * Provided Key mode (PK) + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + /** + * @brief Multi reader support. Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Provided Key mode (PK) + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key provided key + * Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * No authentication + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + // 121212 + /** + * @brief Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. + * + * If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * Multi reader support + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationd2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfigurationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. Provided Key mode (PK) + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. No authentication + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Function allows to set card master key, and application master key configuration settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr ordinal number of AES key in the reader + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_2k3des_key_nr, uint8_t aid_key_no, uint8_t old_2k3des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_2k3des_key_nr, uint8_t aid_key_no, + uint8_t old_2k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key_nr ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_des3k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_3k3des_key_nr, uint8_t aid_key_no, + uint8_t old_3k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of the key stored in the reader + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. 128 bit AES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_des_key[8], uint8_t aid_key_no, IN uint8_t old_des_key[8], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_des_key[8], uint8_t aid_key_no, + IN uint8_t old_des_key[8], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key pointer to 32 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key 24 bytes array that represent 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key 24 bytes array that represent current 3K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des3k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_3k3des_key[24], uint8_t aid_key_no, + IN uint8_t old_3k3des_key[24], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key pointer to array contained new AES key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t auth_key_type, IN uint8_t *new_key, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr key index of AES key stored in the reader that will be new AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr key index of AES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeAesKey_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des3k_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_des3k_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange3k3desKey_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des3k_key_nr, uint8_t aid_key_no, uint8_t old_des3k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows you to change any AES key on the card. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. *only uFR CS with SAM support + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of a key stored in the reader that will be new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief + * Function writes AES key (16 bytes) into reader. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key in the reader (0 - 15) + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_no, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Function writes AES key (16 bytes) into reader. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param key_no ordinal number of key in the reader (0 - 15) + * @param key pointer to array containing the key + * @param key_type enumerated key type (0 - 3) + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteKeyM(UFR_HANDLE hndUFR, uint8_t key_no, IN uint8_t *key, uint8_t key_type); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIdsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_no_auth_M(UFR_HANDLE hndUFR, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t number_of_records, uint16_t record_size, uint8_t communication_settings, + uint8_t *data, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + uint8_t *data, + uint16_t *card_status, + uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuth_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileDesAuth_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile2k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. Provided Key mode (PK) + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multireader support. 128 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no ey for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsSdmAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows changing of file settings + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * *only uFR CS with SAM support + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetTransactionTimerAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). . + * + * Multi reader support. + * From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param card_uid 7 bytes length card UID + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireUidReadECCSignatureM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, OUT uint8_t *card_uid, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aesM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOnM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function prohibits the blinking of the green diode independently of the user's signaling command. LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOffM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOnM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOffM(UFR_HANDLE hndUFR); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t CWGsNOff, uint8_t ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API FastFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersM(UFR_HANDLE hndUFR, uint8_t *mui, uint8_t *serial_nr, uint8_t *hw_type, uint8_t *hw_ver, + uint8_t *device_type, uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrateM(UFR_HANDLE hndUFR, OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersPN7462_M(UFR_HANDLE hndUFR, uint8_t *die_id, uint8_t *serial_nr, + + uint8_t *hw_type, uint8_t *hw_ver, uint8_t *device_type, + uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + // SAM + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_rawM(UFR_HANDLE hndUFR, OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_versionM(UFR_HANDLE hndUFR, VAR SAM_HW_TYPE *sam_type, VAR uint8_t *sam_uid); + + /** + * @brief Multi reader support. Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_rawM(UFR_HANDLE hndUFR, uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_v ADD DESCRIPTION + * @param des_key ADD DESCRIPTION + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_desM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_keyM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param master_aes_key ADD DESCRIPTION + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_modeM(UFR_HANDLE hndUFR, IN uint8_t *master_aes_key, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plainM(UFR_HANDLE hndUFR, IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *keyA, + IN uint8_t *keyB, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_ULC_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_desfire_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, + uint8_t ver_a, IN uint8_t *aes_key_ver_b, uint8_t ver_b, + IN uint8_t *aes_key_ver_c, uint8_t ver_c, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, uint8_t sam_lock_unlock, + uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKeyM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * Multi reader support. + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeableM(UFR_HANDLE hndUFR); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * Multi reader support. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfResetM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOnM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch off RF field at the reader. + * + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOffM(UFR_HANDLE hndUFR); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderIdM(UFR_HANDLE hndUFR, uint8_t *reader_id); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePersoM(UFR_HANDLE hndUFR, uint16_t address, IN uint8_t *data); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPersoM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param card_master_key pointer to 16 byte array containing the card master key + * @param card_config_key pointer to 16 byte array containing the card configuration key + * @param level_2_switch_key pointer to 16 byte array containing the key for switch to security level 2 + * @param level_3_switch_key pointer to 16 byte array containing the key for switch to security level 3 + * @param level_1_auth_key pointer to 16 byte array containing the key for optional authentication at security level 1 + * @param select_vc_key pointer to 16 byte array containing the key for virtual card selection + * @param prox_chk_key pointer to 16 byte array containing the key for proximity check + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling + * @param vc_poll_mac_key pointer to 16 byte array containing the MAC key for virtual card polling + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimalM(UFR_HANDLE hndUFR, IN uint8_t *card_master_key, IN uint8_t *card_config_key, + IN uint8_t *level_2_switch_key, IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, + IN uint8_t *select_vc_key, IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, + IN uint8_t *vc_poll_mac_key); + + /** + * @brief Multi reader support. Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, + uint8_t prox_check_use); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ADordinary number of current sector key stored into reader that wile become new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKeyM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, + OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @param hndUFR handle of the uFR device + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PKM(UFR_HANDLE hndUFR, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief Multi reader support. Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PKM(UFR_HANDLE hndUFR, IN uint8_t *key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_authM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + // ESP32 + /** + * @brief Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. + * + * Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayData(IN uint8_t *display_data, IN uint8_t data_length, uint16_t duration); + + /** + * @brief Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderReset(void); + + /** + * @brief It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM of uFR Online. + * + * Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param time pointer to the array containing current date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTime(OUT uint8_t *time); + + /** + * @brief Function sets the date and time into uFR Online RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOState(uint8_t pin, uint8_t state); + + /** + * @brief Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOState(OUT uint8_t *state); + + /** + * @brief Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReader(uint8_t reader); + + /** + * @brief Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param SerialNumber pointer to SerialNumber variable. “SerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumber(VAR uint32_t *SerialNumber); + + /** + * @brief Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersion(OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOff(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifi(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableWifi(void); + + // NDEF MESSAGES + //---------------------------------------------------------- + + enum NDEF_STORAGE_MODE + { + STORE_INTO_READER = 0, + STORE_INTO_CARD + }; + + enum NDEF_SKYPE_ACTION + { + CALL = 0, + CHAT + }; + + // WiFi NDEF authentication type + enum WIFI_AUTH_TYPE + { + OPEN = 0, + WPA_PERSONAL, + WPA_ENTERPRISE, + WPA2_ENTERPRISE, + WPA2_PERSONAL + }; + + // WiFi NDEF encryption type + enum WIFI_ENC_TYPE + { + NONE = 0, + WEP, + TKIP, + AES, + AES_TKIP + }; + + /** + * @brief + * Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFi(uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, uint8_t encryption_type, + IN const char *password); + + /** + * @brief Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters)(e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BT(uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMS(uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Bitcoin(uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocation(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestination(uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Email(uint8_t ndef_storage, IN const char *email_address, IN const char *subject, IN const char *message); + + /** + * @brief Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Address(uint8_t ndef_storage, IN const char *address); + + /** + * @brief Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidApp(uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Store text as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Text(uint8_t ndef_storage, IN const char *text); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetView(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Skype(uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Whatsapp(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Viber(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Contact(uint8_t ndef_storage, IN const char *name, IN const char *company, IN const char *address, + IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Phone(uint8_t ndef_storage, IN const char *phone_number); + + /** + * @brief Multi reader support. Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFiM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, + uint8_t encryption_type, IN const char *password); + + /** + * @brief Multi reader support. Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters) (e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BTM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Multi reader support. Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMSM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Multi reader support. Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BitcoinM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Multi reader support. Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_EmailM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *email_address, IN const char *subject, + IN const char *message); + + /** + * @brief Multi reader support. Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AddressM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *address); + + /** + * @brief Multi reader support. Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Multi reader support. Store text as NDEF message into reader or into card. + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_TextM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *text); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetViewM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SkypeM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Multi reader support. Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WhatsappM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ViberM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ContactM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *name, IN const char *company, + IN const char *address, IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Multi reader support. Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_PhoneM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number); + //--------------------------------------------------------------------------------------------- + /** + * @brief Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF + * + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFi(OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, OUT char *password); + + /** + * @brief Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Bitcoin(OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocation(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF + * + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestination(OUT char *destination); + + /** + * @brief Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Email(OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF + * + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Address(OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF + * + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidApp(OUT char *package_name); + + /** + * @brief Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF + * + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Text(OUT char *text); + + /** + * @brief Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetView(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF + * + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Skype(OUT char *user_name, OUT char *action); + + /** + * @brief Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Whatsapp(OUT char *message); + + /** + * @brief Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Viber(OUT char *message); + + /** + * @brief Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF + * + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Contact(OUT char *vCard); + + /** + * @brief Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Phone(OUT char *phone_number); + + /** + * @brief Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMS(OUT char *phone_number, OUT char *message); + + /** + * @brief Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BT(OUT char *bt_mac_address); + + /** + * @brief Multi reader support. Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFiM(UFR_HANDLE hndUFR, OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, + OUT char *password); + + /** + * @brief Multi reader support. Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BitcoinM(UFR_HANDLE hndUFR, OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, OUT char *destination); + + /** + * @brief Multi reader support. Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_EmailM(UFR_HANDLE hndUFR, OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AddressM(UFR_HANDLE hndUFR, OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, OUT char *package_name); + + /** + * @brief Multi reader support. Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_TextM(UFR_HANDLE hndUFR, OUT char *text); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetViewM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SkypeM(UFR_HANDLE hndUFR, OUT char *user_name, OUT char *action); + + /** + * @brief Multi reader support. Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WhatsappM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ViberM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ContactM(UFR_HANDLE hndUFR, OUT char *vCard); + + /** + * @brief Multi reader support. Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_PhoneM(UFR_HANDLE hndUFR, OUT char *phone_number); + + /** + * @brief Multi reader support. Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMSM(UFR_HANDLE hndUFR, OUT char *phone_number, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BTM(UFR_HANDLE hndUFR, OUT char *bt_mac_address); + + /** + * @brief Used to parse NDEF record into separate parameters + * + * @ingroup Card_Tag_NDEF + * + * @param type_record pointer to the array containing record type + * @param type_len length of the record type + * @param payload pointer to the array containing record payload + * @param payload_len length of the record payload + * + * @return Operation status + */ + c_string DL_API ParseNdefMessage(IN uint8_t *type_record, uint8_t type_len, IN uint8_t *payload, uint32_t payload_len); + + // NT4H + + /** + * @brief Multi reader support. Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parametersM(UFR_HANDLE hndUFR, uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function returns file settings. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext); + + /** + * @brief Multi reader support. Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_ridM(UFR_HANDLE hndUFR, uint8_t aes_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uidM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_keyM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctrM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. No authentication + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_authM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signatureM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_statusM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_authM(UFR_HANDLE hndUFR, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_ttM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_fileM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief Multi reader support. Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint16_t duration); + + /** + * @brief Multi reader support. Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPasswordM(UFR_HANDLE hndUFR, uint8_t *old_password, uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM of uFR Online. Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWriteM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size, uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromReadM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into uFR Online RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *password, uint8_t *time); + + /** + * @brief Multi reader support. Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOStateM(UFR_HANDLE hndUFR, uint8_t pin, uint8_t state); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOStateM(UFR_HANDLE hndUFR, uint8_t *state); + + /** + * @brief Multi reader support. Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReaderM(UFR_HANDLE hndUFR, uint8_t reader); + + /** + * @brief Multi reader support. Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumberM(UFR_HANDLE hndUFR, uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersionM(UFR_HANDLE hndUFR, OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Multi reader support. Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOffM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableOnWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + + UFR_STATUS DL_API COMTransceiveM(UFR_HANDLE hndUFR, IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General + * + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + UFR_STATUS DL_API COMTransceive(IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + // DLL version ---------------------------------------------------------------- + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + uint32_t DL_API GetDllVersion(void); + + /* + * Get "exploded" dll version example: + * + * #include + * #include + * + * void main(int argc, char *argv[]) + * { + * uint32_t dwDllVersion = 0; + * uint32_t dwDllMajorVersion = 0; + * uint32_t dwDllMinorVersion = 0; + * uint32_t dwDllBuild = 0; + * + * dwDllVersion = GetDllVersion(); + * + * // "explode" the dll version: + * dwDllMajorVersion = (DWORD)(LOBYTE(LOWORD(dwDllVersion))); + * dwDllMinorVersion = (DWORD)(HIBYTE(LOWORD(dwDllVersion))); + * + * // Get the dll build number. + * dwDllBuild = (DWORD)(HIWORD(dwDllVersion)); + * + * printf("Dll version is %ld.%ld (%ld)\n", dwDllMajorVersion, + * dwDllMinorVersion, + * dwDllBuild); + * } + * + */ + // Originality Check (performs the check is the chip on the card/tag NXP genuine): + /** + * @brief This function depends on OpenSSL crypto library. Since OpenSSL crypto library is dynamically linked during execution, the only prerequisite for a successful call to this function is that the libeay32.dll is in the current folder (valid for Windows) and / or libcrypto.so is in the environment path (e.g. LD_LIBRARY_PATH on Linux / macOS). OriginalityCheck() performs the check if the chip on the card / tag is NXP genuine. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param signature ECCSignature acquired by call to the ReadECCSignature() function. + * @param uid Card UID. Best if the card UID is acquired by previous call to the ReadECCSignature() function. + * @param uid_len Card UID length. Best if the card UID length is acquired by previous call to the ReadECCSignature() function. + * @param DlogicCardType Card type. Best if the DlogicCardType is acquired by previous call to the ReadECCSignature() function. + * + * @return Operation status + */ + UFR_STATUS DL_API OriginalityCheck(IN const uint8_t *signature, IN const uint8_t *uid, uint8_t uid_len, uint8_t DlogicCardType); + // Returns: + // UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND in case there is no OpenSSL library (libeay32.dll) in current folder or path + // UFR_OPEN_SSL_DYNAMIC_LIB_FAILED in case of OpenSSL library error (e.g. wrong OpenSSL version) + // UFR_NOT_NXP_GENUINE if chip on the card/tag is NOT NXP genuine + // UFR_OK is chip on the card/tag is NXP GENUINE + + //// debug functions: + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + c_string DL_API GetDllVersionStr(void); + + /** + * @brief Returns UFR_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param status UFR_STATUS status variable + * + * @return Operation status + */ + c_string DL_API UFR_Status2String(const UFR_STATUS status); + + /** + * @brief Returns UFR_SESSION_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param session_status UFR_SESSION_STATUS status variable + * + * @return c_string value of the status code + */ + c_string DL_API UFR_SessionStatus2String(const UFR_SESSION_STATUS session_status); + + /** + * @brief Returns card type as a c_string instead of byte value + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param dl_type_code card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + c_string DL_API UFR_DLCardType2String(uint8_t dl_type_code); + +//// Helper functions: +#ifndef _WIN32 + + unsigned long GetTickCount(void); + +#endif // #ifndef _WIN32 + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information + * + * @return The reader's descriptive name + */ + c_string DL_API GetReaderDescription(void); + + /** + * @brief Multi reader support. This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * + * @return Returns the reader's descriptive name. + */ + c_string DL_API GetReaderDescriptionM(UFR_HANDLE hndUFR); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +//#ifdef _WIN32 || __linux__ + +//#else +//#endif // _WIN32 + + + +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#ifdef __ANDROID__ +#include + + extern JNIEnv *global_env; + extern jclass global_class; + extern jclass usb_global_class; + + /** + + * + * @param env + * @param class1 + * + * @return Operation status + */ + void DL_API initVM(JNIEnv *env, jclass class1); +#endif + +#ifdef __cplusplus +} +#endif + +#ifdef __APPLE__ +#include + #if TARGET_OS_IPHONE + typedef void (*CardDetectedCallback)(void* _Nonnull context,const char *uid, const char* dl_card_type, const char* manufacturer); + typedef void (*CardRemovedCallback)(void* _Nonnull context); + typedef void (*SessionErrorCallback)(void* _Nonnull context, UFR_SESSION_STATUS error_code, const char* error_description); + /** + * @brief For iOS only: This function is used to set message displayed when the NFC Session window is started
+ * E.g 'Read the tag with the phone' + * NFC Session can be started via ReaderOpenEx() and appropriate parameters, or openNFCSession() + * @since uFCoder library version 6.0.0 + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + void setNFCMessage(const char *message); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * @param context pointer to UIView that bridges Swift with native code. e.g `let ble_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(void* _Nonnull context, const char* reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + void DL_API closeBLESession(void); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param context pointer to UIView that bridges Swift with native code. e.g `let nfc_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(void* _Nonnull context, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char* license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); + #else + typedef void (*CardDetectedCallback)(const char *uid, const char* dl_card_type, const char* manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char* error_description); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); + + #endif // TARGET_OS_IPHONE +#endif // __APPLE__ + +#ifdef __ANDROID__ + typedef void (*CardDetectedCallback)(const char *uid, const char* dl_card_type, const char* manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char* error_description); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param reader_sn uFR Online reader serial number (e.g ONXXXXXX) + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param session_error_callback TEST + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(const char* reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openBLESession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeBLESession(void); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char* license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); +#endif // __ANDROID__ + +#if defined(_WIN32) || defined(__linux__) + typedef void (*CardDetectedCallback)(const char *uid, const char* dl_card_type, const char* manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char* error_description); + + /** + * @brief This function is used to enable asynchronous event-driven API callbacks.
+ * Prerequisites: ReaderOpen() or ReaderOpenEx() must be called first and must return `UFR_OK` status to open connection with the reader
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by StartAsyncSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + UFR_STATUS DL_API StopAsyncSession(); + +#endif // _WIN32 || __linux__ + +#ifndef ESP_PLATFORM + /** + * @brief This function is used to set or change the function that wil be called as a 'CardDetectedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardDetectedCallback(CardDetectedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardRemovedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardRemovedCallback(CardRemovedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'SessionErrorCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setSessionErrorCallback(SessionErrorCallback callback); +#endif + + +#endif /* uFCoder_H_ */ diff --git a/ufr-lib/esp32/lib/libufcoder.a b/ufr-lib/esp32/lib/libufcoder.a new file mode 100644 index 0000000..1f82b41 Binary files /dev/null and b/ufr-lib/esp32/lib/libufcoder.a differ diff --git a/ufr-lib/include/uFCoder.h b/ufr-lib/include/uFCoder.h new file mode 100644 index 0000000..361b60f --- /dev/null +++ b/ufr-lib/include/uFCoder.h @@ -0,0 +1,49871 @@ +/* + * uFCoder.h + * + * library version: 6.0.21 + * + * Created on: 2009-01-14 + * Last edited: 2025-06-18 + * + * Author: D-Logic + */ +#ifndef uFCoder_H_ +#define uFCoder_H_ + +#include +#include +#include + +#define IN // array that you pass to function +#define OUT // array that you receive from function +#define VAR // first element of array that you receive from function (single variable) + +//////////////////////////////////////////////////////////////////// +/** + * Type for representing null terminated char array ( aka C-String ) + * Array is always one byte longer ( for null character ) then string + * Memory space for array must be allocated before use. + */ +typedef const char *c_string; +//////////////////////////////////////////////////////////////////// + +#ifdef _WIN32 +// WINDOWS +#if defined(DL_CREATE_STATIC_LIB) || defined(DL_USE_STATIC_LIB) +#define DL_API +#else +#ifndef DL_uFC_EXPORTS +#ifdef _WIN_IOT +#define DL_API __declspec(dllimport) // Win IoT +#else +#define DL_API /*__declspec(dllimport) */ __stdcall // STDCALL - GCC - .NET +#endif // _WIN_IOT +#else +#define DL_API __declspec(dllexport) __stdcall +#endif // DL_uFC_EXPORTS +#endif // DL_CREATE_STATIC_LIB +#else +// Linux & MAC OS +#define DL_API +#endif // _WIN32 + +#if defined(DL_uFC_EXPORTS) || defined(DL_CREATE_STATIC_LIB) || defined(__ANDROID__) || defined(ESP_PLATFORM) || defined(IOS_PLATFORM) +typedef struct S_UFR_HANDLE *UFR_HANDLE; +#else +typedef void *UFR_HANDLE; +#endif + +// MIFARE CLASSIC type id's: +#define MIFARE_CLASSIC_1k 0x08 +#define MF1ICS50 0x08 +#define SLE66R35 0x88 // Infineon = Mifare Classic 1k +#define MIFARE_CLASSIC_4k 0x18 +#define MF1ICS70 0x18 +#define MIFARE_CLASSIC_MINI 0x09 +#define MF1ICS20 0x09 + +// DLOGIC CARD TYPE +#define TAG_UNKNOWN 0 +#define DL_MIFARE_ULTRALIGHT 0x01 +#define DL_MIFARE_ULTRALIGHT_EV1_11 0x02 +#define DL_MIFARE_ULTRALIGHT_EV1_21 0x03 +#define DL_MIFARE_ULTRALIGHT_C 0x04 +#define DL_NTAG_203 0x05 +#define DL_NTAG_210 0x06 +#define DL_NTAG_212 0x07 +#define DL_NTAG_213 0x08 +#define DL_NTAG_215 0x09 +#define DL_NTAG_216 0x0A +#define DL_MIKRON_MIK640D 0x0B +#define NFC_T2T_GENERIC 0x0C +#define DL_NT3H_1101 0x0D +#define DL_NT3H_1201 0x0E +#define DL_NT3H_2111 0x0F +#define DL_NT3H_2211 0x10 +#define DL_NTAG_413_DNA 0x11 +#define DL_NTAG_424_DNA 0x12 +#define DL_NTAG_424_DNA_TT 0x13 +#define DL_NTAG_210U 0x14 +#define DL_NTAG_213_TT 0x15 + +#define DL_MIFARE_CLASSIC_2K 0x19 +#define DL_MIFARE_MINI 0x20 +#define DL_MIFARE_CLASSIC_1K 0x21 +#define DL_MIFARE_CLASSIC_4K 0x22 +#define DL_MIFARE_PLUS_S_2K_SL0 0x23 +#define DL_MIFARE_PLUS_S_4K_SL0 0x24 +#define DL_MIFARE_PLUS_X_2K_SL0 0x25 +#define DL_MIFARE_PLUS_X_4K_SL0 0x26 +#define DL_MIFARE_DESFIRE 0x27 +#define DL_MIFARE_DESFIRE_EV1_2K 0x28 +#define DL_MIFARE_DESFIRE_EV1_4K 0x29 +#define DL_MIFARE_DESFIRE_EV1_8K 0x2A +#define DL_MIFARE_DESFIRE_EV2_2K 0x2B +#define DL_MIFARE_DESFIRE_EV2_4K 0x2C +#define DL_MIFARE_DESFIRE_EV2_8K 0x2D +#define DL_MIFARE_PLUS_S_2K_SL1 0x2E +#define DL_MIFARE_PLUS_X_2K_SL1 0x2F +#define DL_MIFARE_PLUS_EV1_2K_SL1 0x30 +#define DL_MIFARE_PLUS_X_2K_SL2 0x31 +#define DL_MIFARE_PLUS_S_2K_SL3 0x32 +#define DL_MIFARE_PLUS_X_2K_SL3 0x33 +#define DL_MIFARE_PLUS_EV1_2K_SL3 0x34 +#define DL_MIFARE_PLUS_S_4K_SL1 0x35 +#define DL_MIFARE_PLUS_X_4K_SL1 0x36 +#define DL_MIFARE_PLUS_EV1_4K_SL1 0x37 +#define DL_MIFARE_PLUS_X_4K_SL2 0x38 +#define DL_MIFARE_PLUS_S_4K_SL3 0x39 +#define DL_MIFARE_PLUS_X_4K_SL3 0x3A +#define DL_MIFARE_PLUS_EV1_4K_SL3 0x3B +#define DL_MIFARE_PLUS_SE_SL0 0x3C +#define DL_MIFARE_PLUS_SE_SL1 0x3D +#define DL_MIFARE_PLUS_SE_SL3 0x3E +#define DL_MIFARE_DESFIRE_LIGHT 0x3F + +#define DL_UNKNOWN_ISO_14443_4 0x40 +#define DL_GENERIC_ISO14443_4 0x40 +#define DL_GENERIC_ISO14443_4_TYPE_B 0x41 +#define DL_GENERIC_ISO14443_3_TYPE_B 0x42 +#define DL_MIFARE_PLUS_EV1_2K_SL0 0x43 +#define DL_MIFARE_PLUS_EV1_4K_SL0 0x44 +#define DL_MIFARE_DESFIRE_EV3_2K 0x45 +#define DL_MIFARE_DESFIRE_EV3_4K 0x46 +#define DL_MIFARE_DESFIRE_EV3_8K 0x47 + +// ISO15693 cards +#define DL_GENERIC_ISO15693 0x50 +#define DL_ICODE_SLIX 0x51 +#define DL_ICODE_SLIX_S 0x52 +#define DL_ICODE_SLIX_L 0x53 +#define DL_ICODE_SLIX_2 0x54 +#define DL_ICODE_DNA 0x55 +#define DL_ICODE_3 0x56 + +#define DL_MOBILE_AID 0x60 +#define DL_APPLE_VAS_V1 0x6A +#define DL_APPLE_VAS_V2 0x6B +#define DL_IMEI_UID 0x80 + +// ST Product ID-s: +#define M24SR02 0x82 +#define M24SR02_AUTOMOTIVE 0x8A +#define M24SR04 0x86 +#define M24SR04_AUTOMOTIVE 0x8E +#define M24SR16 0x85 +#define M24SR16_AUTOMOTIVE 0x8D +#define M24SR64 0x84 +#define M24SR64_AUTOMOTIVE 0x8C + +// DLJavaCardTypes: +#define DLSigner81 0xA0 +#define DLSigner22 0xA1 +#define DLSigner30 0xA2 +#define DLSigner10 0xA3 +#define DLSigner145 0xAA + +enum E_CARD_IN_SAM_SLOT +{ + SAM_SLOT_MIFARE_SAM_AV2 = 1, + SAM_SLOT_GENERIC = 4 +}; + +// DLJavaCardSignerAlgorithmTypes: +enum E_SIGNER_CIPHERS +{ + SIG_CIPHER_RSA = 0, + SIG_CIPHER_ECDSA, + + SIG_CIPHER_MAX_SUPPORTED +}; + +enum E_SIGNER_RSA_PADDINGS +{ + PAD_NULL = 0, + PAD_PKCS1_V1_5, + PAD_PKCS1_PSS, + + SIG_PAD_MAX_SUPPORTED +}; +#define PAD_PKCS1 PAD_PKCS1_V1_5 + +enum E_SIGNER_DIGESTS +{ + ALG_NULL = 0, + ALG_SHA, + ALG_SHA_256, + ALG_SHA_384, + ALG_SHA_512, + ALG_SHA_224, + ALG_SHA_512_224, + ALG_SHA_512_256, + + SIG_DIGEST_MAX_SUPPORTED +}; + +enum E_KEY_TYPES +{ + TYPE_RSA_PRIVATE = 0, + TYPE_RSA_CRT_PRIVATE, + TYPE_EC_F2M_PRIVATE, + TYPE_EC_FP_PRIVATE +}; + +enum E_OBJ_TYPES +{ + OBJ_TYPE_RSA_CERT = 0, + OBJ_TYPE_EC_CERT, + OBJ_TYPE_CA_CERT, + + OBJ_TYPES_COUNT +}; + +// JCDL_AIDs +#define DL_RAW_SIZEOF_SZ(x) (sizeof(x) - 1) +#define DL_AID_RID_PLUS "\xF0" "DLogic" +#define DL_SIGNER_PIX "\x00\x01" +#define DL_STORAGE_PIX "\x01\x01" +#define DL_SIGNER_AID DL_AID_RID_PLUS DL_SIGNER_PIX +#define DL_SIGNER_AID_SIZE 9 +#define DL_STORAGE_AID DL_AID_RID_PLUS DL_STORAGE_PIX +#define DL_STORAGE_AID_SIZE 9 + +// Universal JCDL instructions: +#define INS_LOGIN 0x20 +#define INS_GET_PIN_TRIES_REMAINING 0x21 +#define INS_PIN_CHANGE 0x22 +#define INS_PIN_UNBLOCK 0x23 + +// JCDLStorage instructions: +#define INS_PIN_ENABLE 0x24 +#define INS_PIN_DISABLE 0x25 +#define INS_LIST_FILES 0x31 +#define INS_GET_FILE_SIZE 0x32 +#define INS_READ_FILE 0x33 +#define INS_WRITE_FILE 0x34 +#define INS_DELETE_FILE 0x3F + +// JCDLSigner instructions: +#define INS_SET_RSA_PRIKEY 0x51 +#define INS_GEN_RSA_KEY_PAIR 0x52 +#define INS_GET_RSA_PUBKEY_MODULUS 0x53 +#define INS_GET_RSA_PUBKEY_EXPONENT 0x54 +#define INS_DEL_RSA_KEY_PAIR 0x5F +#define INS_SET_EC_PRIKEY 0x61 +#define INS_GEN_EC_KEY_PAIR 0x62 +#define INS_GET_EC_PUBKEY 0x63 +#define INS_GET_EC_FIELD 0x64 +#define INS_GET_EC_AB 0x65 +#define INS_GET_EC_G 0x66 +#define INS_GET_EC_RK_SIZE 0x67 +#define INS_DEL_EC_KEY_PAIR 0x6F +#define INS_GET_SIGNATURE 0x71 +#define INS_PUT_OBJ 0x31 +#define INS_PUT_OBJ_SUBJECT 0x32 +#define INS_INVALIDATE_CERT 0x33 +#define INS_GET_OBJ 0x41 +#define INS_GET_OBJ_ID 0x42 +#define INS_GET_OBJ_SUBJECT 0x43 + +// Universal JCDL constants: +#define PIN_MAX_TRIES 5 +#define PIN_MIN_LENGTH 4 +#define PIN_MAX_LENGTH 8 +#define PUK_MAX_TRIES 10 +#define PUK_LENGTH 8 + +// JCDLSigner constants: +#define JC_APP_MAX_KEY_INDEX ((3) - 1) +#define JC_APP_MAX_CA_CERT_INDEX ((12) - 1) +#define JC_APP_MAX_ID_SIZE 253 +#define JC_APP_MAX_SUBJECT_SIZE 255 +#define JC_APP_MAX_SIGNATURE_LEN 256 +#define JC_APP_MAX_PIN_LENGTH 8 + +// JCDLStorage constants: +#define JC_DL_STORAGE_MAX_FILES 16 +#define JC_DL_STORAGE_MAX_FILE_SIZE (32 * 1024 - 2) // 32KB - 2 byte system reserved + +// MIFARE CLASSIC Authentication Modes: +enum MIFARE_AUTHENTICATION +{ + MIFARE_AUTHENT1A = 0x60, + MIFARE_AUTHENT1B = 0x61, +}; + +// MIFARE PLUS AES Authentication Modes: +enum MIFARE_PLUS_AES_AUTHENTICATION +{ + MIFARE_PLUS_AES_AUTHENT1A = 0x80, + MIFARE_PLUS_AES_AUTHENT1B = 0x81, +}; + +enum MIFARE_PLUS_AES_KEY_TYPE +{ + MIFARE_PLUS_AES_KEY_A = 1, + MIFARE_PLUS_AES_KEY_B = 2, +}; + +// T2T authentication constants: +enum T2T_AUTHENTICATION +{ + T2T_NO_PWD_AUTH = 0, + T2T_RKA_PWD_AUTH = 1, + T2T_PK_PWD_AUTH = 3, + T2T_WITHOUT_PWD_AUTH = 0x60, + T2T_WITH_PWD_AUTH = 0x61, +}; + +// T4T authentication constants +enum T4T_AUTHENTICATION +{ + T4T_WITHOUT_PWD_AUTH = 0x60, + T4T_PK_PWD_AUTH = 0x80, + T4T_RKA_PWD_AUTH = 0x02, +}; + +enum ADDRESS_MODE +{ + ADDRESS_MODE_BLOCK = 0, + ADDRESS_MODE_SECTOR, +}; + +#define MAX_UID_LEN 10 +#define MAX_ATS_LEN 25 +#define ECC_SIG_LEN 32 + +// API Status Codes Type: +typedef enum UFCODER_ERROR_CODES +{ + UFR_OK = 0x00, + UFR_COMMUNICATION_ERROR = 0x01, + UFR_CHKSUM_ERROR = 0x02, + UFR_READING_ERROR = 0x03, + UFR_WRITING_ERROR = 0x04, + UFR_BUFFER_OVERFLOW = 0x05, + UFR_MAX_ADDRESS_EXCEEDED = 0x06, + UFR_MAX_KEY_INDEX_EXCEEDED = 0x07, + UFR_NO_CARD = 0x08, + UFR_COMMAND_NOT_SUPPORTED = 0x09, + UFR_FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER = 0x0A, + UFR_ADDRESSED_BLOCK_IS_NOT_SECTOR_TRAILER = 0x0B, + UFR_WRONG_ADDRESS_MODE = 0x0C, + UFR_WRONG_ACCESS_BITS_VALUES = 0x0D, + UFR_AUTH_ERROR = 0x0E, + UFR_PARAMETERS_ERROR = 0x0F, + UFR_MAX_SIZE_EXCEEDED = 0x10, + UFR_UNSUPPORTED_CARD_TYPE = 0x11, + + UFR_COMMUNICATION_BREAK = 0x50, + UFR_NO_MEMORY_ERROR = 0x51, + UFR_CAN_NOT_OPEN_READER = 0x52, + UFR_READER_NOT_SUPPORTED = 0x53, + UFR_READER_OPENING_ERROR = 0x54, + UFR_READER_PORT_NOT_OPENED = 0x55, + UFR_CANT_CLOSE_READER_PORT = 0x56, + UFR_BLE_INVALID_PAIRING = 0x57, + + UFR_I2C_BUS_ERROR = 0x6A, + UFR_ECC_STORAGE_ERROR = 0x6B, + + UFR_WRITE_VERIFICATION_ERROR = 0x70, + UFR_BUFFER_SIZE_EXCEEDED = 0x71, + UFR_VALUE_BLOCK_INVALID = 0x72, + UFR_VALUE_BLOCK_ADDR_INVALID = 0x73, + UFR_VALUE_BLOCK_MANIPULATION_ERROR = 0x74, + UFR_WRONG_UI_MODE = 0x75, + UFR_KEYS_LOCKED = 0x76, + UFR_KEYS_UNLOCKED = 0x77, + UFR_WRONG_PASSWORD = 0x78, + UFR_CAN_NOT_LOCK_DEVICE = 0x79, + UFR_CAN_NOT_UNLOCK_DEVICE = 0x7A, + UFR_DEVICE_EEPROM_BUSY = 0x7B, + UFR_RTC_SET_ERROR = 0x7C, + + ANTI_COLLISION_DISABLED = 0x7D, + NO_TAGS_ENUMERRATED = 0x7E, + CARD_ALREADY_SELECTED = 0x7F, + + // NDEF error codes + UFR_WRONG_NDEF_CARD_FORMAT = 0x80, + UFR_NDEF_MESSAGE_NOT_FOUND = 0x81, + UFR_NDEF_UNSUPPORTED_CARD_TYPE = 0x82, + UFR_NDEF_CARD_FORMAT_ERROR = 0x83, + UFR_MAD_NOT_ENABLED = 0x84, + UFR_MAD_VERSION_NOT_SUPPORTED = 0x85, + UFR_NDEF_MESSAGE_NOT_COMPATIBLE = 0x86, + + // Tag emulation mode errors: + FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90, + + // FTDI errors: + UFR_FT_STATUS_ERROR_1 = 0xA0, + UFR_FT_STATUS_ERROR_2 = 0xA1, + UFR_FT_STATUS_ERROR_3 = 0xA2, + UFR_FT_STATUS_ERROR_4 = 0xA3, + UFR_FT_STATUS_ERROR_5 = 0xA4, + UFR_FT_STATUS_ERROR_6 = 0xA5, + UFR_FT_STATUS_ERROR_7 = 0xA6, + UFR_FT_STATUS_ERROR_8 = 0xA7, + UFR_FT_STATUS_ERROR_9 = 0xA8, + + // MIFARE PLUS error codes + UFR_MFP_COMMAND_OVERFLOW = 0xB0, + UFR_MFP_INVALID_MAC = 0xB1, + UFR_MFP_INVALID_BLOCK_NR = 0xB2, + UFR_MFP_NOT_EXIST_BLOCK_NR = 0xB3, + UFR_MFP_COND_OF_USE_ERROR = 0xB4, + UFR_MFP_LENGTH_ERROR = 0xB5, + UFR_MFP_GENERAL_MANIP_ERROR = 0xB6, + UFR_MFP_SWITCH_TO_ISO14443_4_ERROR = 0xB7, + UFR_MFP_ILLEGAL_STATUS_CODE = 0xB8, + UFR_MFP_MULTI_BLOCKS_READ = 0xB9, + + // NT4H error codes + NT4H_COMMAND_ABORTED = 0xC0, + NT4H_LENGTH_ERROR = 0xC1, + NT4H_PARAMETER_ERROR = 0xC2, + NT4H_NO_SUCH_KEY = 0xC3, + NT4H_PERMISSION_DENIED = 0xC4, + NT4H_AUTHENTICATION_DELAY = 0xC5, + NT4H_MEMORY_ERROR = 0xC6, + NT4H_INTEGRITY_ERROR = 0xC7, + NT4H_FILE_NOT_FOUND = 0xC8, + NT4H_BOUNDARY_ERROR = 0xC9, + NT4H_INVALID_MAC = 0xCA, + NT4H_NO_CHANGES = 0xCB, + + // multiple units - return from the functions with ReaderList_ prefix in name + UFR_DEVICE_WRONG_HANDLE = 0x100, + UFR_DEVICE_INDEX_OUT_OF_BOUND, + UFR_DEVICE_ALREADY_OPENED, + UFR_DEVICE_ALREADY_CLOSED, + UFR_DEVICE_IS_NOT_CONNECTED, + + // Originality Check Error Codes: + UFR_NOT_NXP_GENUINE = 0x200, + UFR_OPEN_SSL_DYNAMIC_LIB_FAILED, + UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND, + + // DESFIRE Card Status Error Codes: + READER_ERROR = 0xBB7, // 2999 [dec] + NO_CARD_DETECTED = 0xBB8, // 3000 [dec] + CARD_OPERATION_OK = 0xBB9, // 3001 [dec] + WRONG_KEY_TYPE = 0xBBA, // 3002 [dec] + KEY_AUTH_ERROR = 0xBBB, // 3003 [dec] + CARD_CRYPTO_ERROR = 0xBBC, // 3004 [dec] + READER_CARD_COMM_ERROR = 0xBBD, // 3005 [dec] + PC_READER_COMM_ERROR = 0xBBE, // 3006 [dec] + COMMIT_TRANSACTION_NO_REPLY = 0xBBF, // 3007 [dec] + COMMIT_TRANSACTION_ERROR = 0xBC0, // 3008 [dec] + NOT_SUPPORTED_KEY_TYPE = 0xBC2, // 3010 [dec] + WRONG_FILE_TYPE = 0xBC3, // 3011 [dec] + + DESFIRE_CARD_NO_CHANGES = 0x0C0C, + DESFIRE_CARD_OUT_OF_EEPROM_ERROR = 0x0C0E, + DESFIRE_CARD_ILLEGAL_COMMAND_CODE = 0x0C1C, + DESFIRE_CARD_INTEGRITY_ERROR = 0x0C1E, + DESFIRE_CARD_NO_SUCH_KEY = 0x0C40, + DESFIRE_CARD_LENGTH_ERROR = 0x0C7E, + DESFIRE_CARD_PERMISSION_DENIED = 0x0C9D, + DESFIRE_CARD_PARAMETER_ERROR = 0x0C9E, + DESFIRE_CARD_APPLICATION_NOT_FOUND = 0x0CA0, + DESFIRE_CARD_APPL_INTEGRITY_ERROR = 0x0CA1, + DESFIRE_CARD_AUTHENTICATION_ERROR = 0x0CAE, + DESFIRE_CARD_ADDITIONAL_FRAME = 0x0CAF, + DESFIRE_CARD_BOUNDARY_ERROR = 0x0CBE, + DESFIRE_CARD_PICC_INTEGRITY_ERROR = 0x0CC1, + DESFIRE_CARD_COMMAND_ABORTED = 0x0CCA, + DESFIRE_CARD_PICC_DISABLED_ERROR = 0x0CCD, + DESFIRE_CARD_COUNT_ERROR = 0x0CCE, + DESFIRE_CARD_DUPLICATE_ERROR = 0x0CDE, + DESFIRE_CARD_EEPROM_ERROR_DES = 0x0CEE, + DESFIRE_CARD_FILE_NOT_FOUND = 0x0CF0, + DESFIRE_CARD_FILE_INTEGRITY_ERROR = 0x0CF1, + DESFIRE_CATD_AUTHENTICATION_DELAY = 0X0CAD, + + // uFCoder library errors: + UFR_NOT_IMPLEMENTED = 0x1000, + UFR_COMMAND_FAILED = 0x1001, + UFR_TIMEOUT_ERR = 0x1002, + UFR_FILE_SYSTEM_ERROR = 0x1003, + UFR_FILE_SYSTEM_PATH_NOT_EXISTS = 0x1004, + UFR_FILE_NOT_EXISTS = 0x1005, + UFR_FTD2XX_DLL_NOT_FOUND = 0x1006, + + // uFCoder library/licensing specific + UFR_JSON_INVALID = 0x1012, + UFR_LICENSE_INVALID = 0x1013, + UFR_LICENSE_SAVE_FAILED = 0x1014, + UFR_LICENSE_NOT_FOUND = 0x1015, + UFR_LICENSE_HAS_EXPIRED = 0x1016, + + // SAM module error codes: + UFR_SAM_APDU_ERROR = 0x2000, + UFR_SAM_AUTH_ERROR, + UFR_SAM_CRYPTO_ERROR, + + // TLS, HTTPS Error Codes: + TLS_ERR_OPENING_SOCKET = 0x5000, + TLS_ERR_NO_SUCH_HOST = 0x5001, + TLS_CONNECTING_ERROR = 0x5002, + TLS_ERR_SERVER_UNEXPECTEDLY_CLOSED_CONNECTION = 0x5003, + TLS_ERR_UNKNOWN_GIDS_CERTIFICATE_FORMAT = 0x5004, + TLS_ERR_SET_PIN_FOR_GIDS_CERT_ONLY = 0x5005, + TLS_ERR_GIDS_PIN_CODE_WRONG = 0x5006, + TLS_ERR_UNSUPPORTED_CERTIFICATE_TYPE = 0x5007, + TLS_ERR_PRIVATE_KEY_CONTEXT_WRONG = 0x5008, + + // JC cards APDU Error Codes: + UFR_APDU_JC_APP_NOT_SELECTED = 0x6000, + UFR_APDU_TRANSCEIVE_ERROR = 0xAE, + UFR_APDU_JC_APP_BUFF_EMPTY = 0x6001, + UFR_APDU_WRONG_SELECT_RESPONSE = 0x6002, + UFR_APDU_WRONG_KEY_TYPE = 0x6003, + UFR_APDU_WRONG_KEY_SIZE = 0x6004, + UFR_APDU_WRONG_KEY_PARAMS = 0x6005, + UFR_APDU_WRONG_SIGNING_ALGORITHM = 0x6006, + UFR_APDU_PLAIN_TEXT_MAX_SIZE_EXCEEDED = 0x6007, + UFR_APDU_UNSUPPORTED_KEY_SIZE = 0x6008, + UFR_APDU_UNSUPPORTED_ALGORITHMS = 0x6009, + UFR_APDU_PKI_OBJECT_NOT_FOUND = 0x600A, + UFR_APDU_MAX_PIN_LENGTH_EXCEEDED = 0x600B, + UFR_DIGEST_LENGTH_DOES_NOT_MATCH = 0x600C, + + // reserved: 0x6100, + CRYPTO_SUBSYS_NOT_INITIALIZED = 0x6101, + CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR = 0x6102, + CRYPTO_SUBSYS_MAX_HASH_INPUT_EXCEEDED = 0x6103, + CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM = 0x6104, + CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM = 0x6105, + CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM = 0x6106, + CRYPTO_SUBSYS_WRONG_SIGNATURE = 0x6107, + CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH = 0x6108, + CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE = 0x6109, + CRYPTO_SUBSYS_HASHING_ERROR = 0x610A, + CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS = 0x610B, + CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY = 0x610C, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS = 0x610D, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY = 0x610E, + + UFR_WRONG_PEM_CERT_FORMAT = 0x61C0, + + // X.509 specific statuses: + X509_CAN_NOT_OPEN_FILE = 0x6200, + X509_WRONG_DATA = 0x6201, + X509_WRONG_LENGTH = 0x6202, + X509_UNSUPPORTED_PUBLIC_KEY_TYPE = 0x6203, + X509_UNSUPPORTED_PUBLIC_KEY_SIZE = 0x6204, + X509_UNSUPPORTED_PUBLIC_KEY_EXPONENT = 0x6205, + X509_EXTENSION_NOT_FOUND = 0x6206, + X509_WRONG_SIGNATURE = 0x6207, + X509_UNKNOWN_PUBLIC_KEY_TYPE = 0x6208, + X509_WRONG_RSA_PUBLIC_KEY_FORMAT = 0x6209, + X509_WRONG_ECC_PUBLIC_KEY_FORMAT = 0x620A, + X509_SIGNATURE_NOT_MATCH_CA_PUBLIC_KEY = 0x620B, + X509_UNSUPPORTED_SIGNATURE_SCH = 0x620C, + X509_UNSUPPORTED_ECC_CURVE = 0x620D, + + // PKCS#7 specific statuses: + PKCS7_WRONG_DATA = 0x6241, + PKCS7_UNSUPPORTED_SIGNATURE_SCHEME = 0x6242, + PKCS7_SIG_SCH_NOT_MATCH_CERT_KEY_TYPE = 0x6243, + + PKCS7_WRONG_SIGNATURE = 0x6247, + + // MRTD specific statuses: + MRTD_SECURE_CHANNEL_SESSION_FAILED = 0x6280, + MRTD_WRONG_SOD_DATA = 0x6281, + MRTD_WRONG_SOD_LENGTH = 0x6282, + MRTD_UNKNOWN_DIGEST_ALGORITHM = 0x6283, + MRTD_WARNING_DOES_NOT_CONTAINS_DS_CERT = 0x6284, + MRTD_DATA_GROUOP_INDEX_NOT_EXIST = 0x6285, + MRTD_EF_COM_WRONG_DATA = 0x6286, + MRTD_EF_DG_WRONG_DATA = 0x6287, + MRTD_EF_DG1_WRONG_LDS_VERSION_LENGTH = 0x6288, + MRTD_VERIFY_CSCA_NOT_EXIST = 0x6289, + MRTD_VERIFY_WRONG_DS_SIGNATURE = 0x628A, + MRTD_VERIFY_WRONG_CSCA_SIGNATURE = 0x628B, + MRTD_MRZ_CHECK_ERROR = 0x628C, + MRTD_SESSION_NOT_INITIALIZED = 0x628D, + + // ICAO Master List specific statuses: + ICAO_ML_WRONG_FORMAT = 0x6300, + ICAO_ML_CAN_NOT_OPEN_FILE = 0x6301, + ICAO_ML_CAN_NOT_READ_FILE = 0x6302, + ICAO_ML_CERTIFICATE_NOT_FOUND = 0x6303, + ICAO_ML_WRONG_SIGNATURE = 0x6307, + + // EMV specific statuses + SYS_ERR_OUT_OF_MEMORY = 0x7001, + EMV_ERR_WRONG_INPUT_DATA = 0x7002, + EMV_ERR_MAX_TAG_LEN_BYTES_EXCEEDED = 0x7004, + EMV_ERR_TAG_NOT_FOUND = 0x7005, + EMV_ERR_TAG_WRONG_SIZE = 0x7006, + EMV_ERR_TAG_WRONG_TYPE = 0x7007, + EMV_ERR_IN_CARD_READER = 0x7008, + EMV_ERR_READING_RECORD = 0x7009, + EMV_ERR_PDOL_IS_EMPTY = 0x7010, + EMV_ERR_LIST_FORMAT_NOT_FOUND = 0x7011, + EMV_ERR_AFL_NOT_FOUND = 0x7012, + EMV_ERR_AID_NOT_FOUND = 0x7013, + + // ISO7816-4 Errors (R-APDU) - 2 SW bytes returned by the card, prefixed with 0x000A: + UFR_APDU_SW_TAG = 0x000A0000, + UFR_APDU_SW_OPERATION_IS_FAILED = 0x000A6300, + UFR_APDU_SW_WRONG_PIN_4_TRIES_REMAINING = 0x000A63C4, + UFR_APDU_SW_WRONG_PIN_3_TRIES_REMAINING = 0x000A63C3, + UFR_APDU_SW_WRONG_PIN_2_TRIES_REMAINING = 0x000A63C2, + UFR_APDU_SW_WRONG_PIN_1_TRIES_REMAINING = 0x000A63C1, + UFR_APDU_SW_WRONG_PIN_0_TRIES_REMAINING = 0x000A63C0, + UFR_APDU_SW_WRONG_LENGTH = 0x000A6700, + UFR_APDU_SW_SECURITY_STATUS_NOT_SATISFIED = 0x000A6982, + UFR_APDU_SW_AUTHENTICATION_METHOD_BLOCKED = 0x000A6983, + UFR_APDU_SW_DATA_INVALID = 0x000A6984, + UFR_APDU_SW_CONDITIONS_NOT_SATISFIED = 0x000A6985, + UFR_APDU_SW_WRONG_DATA = 0x000A6A80, + UFR_APDU_SW_FILE_NOT_FOUND = 0x000A6A82, + UFR_APDU_SW_RECORD_NOT_FOUND = 0x000A6A83, + UFR_APDU_SW_DATA_NOT_FOUND = 0x000A6A88, + UFR_APDU_SW_ENTITY_ALREADY_EXISTS = 0x000A6A89, + UFR_APDU_SW_INS_NOT_SUPPORTED = 0x000A6D00, + UFR_APDU_SW_NO_PRECISE_DIAGNOSTIC = 0x000A6F00, + + MAX_UFR_STATUS = 0x7FFFFFFF, + + UFR_DISPLAY_IMAGE_LOAD_ERROR = 0x8001, + UFR_DISPLAY_IMAGE_DIMENSION_ERROR = 0x8002, + UFR_DISPLAY_IMAGE_UNSUPPORTED_CHANNELS = 0x8003, + UFR_DISPLAY_WRITE_CMD_ERROR = 0x8004, + UFR_DISPLAY_READ_ACK_ERROR = 0x8005, + UFR_DISPLAY_WRITE_CMDEXT_ERROR = 0x8006, + UFR_DISPLAY_READ_RESPONSE_ERROR = 0x8007, + UFR_DISPLAY_TEXT_COUNT_OVERFLOW = 0x8008, + UFR_DISPLAY_INDEX_OVERFLOW = 0x8009, + UFR_DISPLAY_WRONG_SIMBOL_NUMB = 0x8010, + UFR_DISPLAY_COMMAND_FAILED = 0x8011 + +} UFR_STATUS; + +typedef enum UFCODER_SESSION_CODES +{ + UFR_SESSION_UNKNOWN_ERROR = 0x00, + UFR_SESSION_CLOSED = 0x01, + UFR_SESSION_EXPIRED = 0x02, + UFR_SESSION_DEVICE_DISCONNECTED = 0x03, + UFR_SESSION_DEVICE_FAILED_TO_CONNECT = 0x04, + + // BLE specific error codes + UFR_BLE_SESSION_ERROR_INVALID_PARAMETERS = 0x11, + UFR_BLE_SESSION_ERROR_INVALID_HANDLE = 0x12, + UFR_BLE_SESSION_ERROR_NOT_CONNECTED = 0x13, + UFR_BLE_SESSION_ERROR_OUT_OF_SPACE = 0x14, + UFR_BLE_SESSION_ERROR_OPERATION_CANCELLED = 0x15, + UFR_BLE_SESSION_ERROR_CONNECTION_TIMEOUT = 0x16, + UFR_BLE_SESSION_ERROR_UUID_NOT_ALLOWED = 0x17, + UFR_BLE_SESSION_ERROR_ALREADY_ADVERTISING = 0x18, + UFR_BLE_SESSION_ERROR_CONNECTION_LIMIT_REACHED = 0x19, + UFR_BLE_SESSION_ERROR_UNKNOWN_DEVICE = 0x20, + UFR_BLE_SESSION_ERROR_OPERATION_NOT_SUPPORTED = 0x21, + UFR_BLE_SESSION_ERROR_PEER_REMOVED_PAIRING_INFORMATION = 0x22, + UFR_BLE_SESSION_ERROR_ENCRYPTION_TIMED_OUT = 0x23, + UFR_BLE_SESSION_ERROR_TOO_MANY_LE_PAIRED_DEVICES = 0x24, + + // NFC specific error codes + + // Sesssion errors + UFR_NFC_SESSION_ERROR_FIRST_NDEF_TAG_READ = 0x30, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TERMINATED_UNEXPECTEDLY = 0x31, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TIMEOUT = 0x32, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_SYSTEM_IS_BUSY = 0x33, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_USER_CANCELED = 0x34, + + // NDEF errors + UFR_NFC_SESSION_ERROR_TAG_NOT_WRITABLE = 0x40, + UFR_NFC_SESSION_ERROR_TAG_SIZE_TOO_SMALL = 0x41, + UFR_NFC_SESSION_ERROR_TAG_UPDATE_FAILURE = 0x42, + UFR_NFC_SESSION_ERROR_ZERO_LENGTH_MESSAGE = 0x43, + + // Transceive errors + UFR_NFC_SESSION_ERROR_RETRY_EXCEEDED = 0x50, + UFR_NFC_SESSION_ERROR_TAG_CONNECTION_LOST = 0x51, + UFR_NFC_SESSION_ERROR_TAG_NOT_CONNECTED = 0x52, + UFR_NFC_SESSION_ERROR_TAG_RESPONSE_ERROR = 0x53, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_SESSION_INVALIDATED = 0x54, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_PACKET_TOO_LONG = 0x55, + + UFR_NFC_SESSION_ERROR_TAG_COMMAND_CONFIGURATION_INVALID_PARAMETERS = 0x56, + + // Other + UFR_NFC_SESSION_ERROR_UNSUPPORTED_FEATURE = 0x61, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER = 0x62, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER_LENGTH = 0x63, + UFR_NFC_SESSION_ERROR_PARAMETER_OUT_OF_BOUNDS = 0x64, + UFR_NFC_SESSION_ERROR_RADIO_DISABLED = 0x65, + UFR_NFC_SESSION_ERROR_SECURITY_VIOLATION = 0x66, + +} UFR_SESSION_STATUS; + +// DESFIRE key settings values +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE 0x09 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE 0x0F +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x01 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x08 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x0E +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x00 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x06 + +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x00 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x01 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x02 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x03 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x04 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x05 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x06 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x08 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x09 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0A +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0B +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTH_AUTH 0x0C +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTH_AUTH 0x0D +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0E +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0F + +enum E_ASYMMETRIC_KEY_TYPES +{ + RSA_PRIVATE_KEY = 0, + ECDSA_PRIVATE_KEY, + + ASYMMETRIC_KEY_TYPES_NUM +}; + +#define MAX_ECC_CURVE_NAME_LEN 30 + +enum E_ECC_CURVE_DEFINITION_TYPES +{ + ECC_CURVE_INDEX, + ECC_CURVE_NAME, + ECC_CURVE_DOMAIN_PARAMETERS, + + ECC_CURVE_DEFINITION_TYPES_NUM +}; + +enum E_SIGNATURE_SCHEMES +{ + SHA1_WITH_RSA, + SHA256_WITH_RSA, + SHA384_WITH_RSA, + SHA512_WITH_RSA, + SHA224_WITH_RSA, + SHA512_224_WITH_RSA, + SHA512_256_WITH_RSA, + + RSA_PSS, + + ECDSA_WITH_SHA1, + ECDSA_WITH_SHA256, + ECDSA_WITH_SHA384, + ECDSA_WITH_SHA512, + ECDSA_WITH_SHA224, + + SIGNATURE_SCHEMES_NUM // Don't change the order. NEVER! +}; +enum E_SIGNATURE_SCH_TYPES +{ + RSA_PKCS1, + RSA_PKCS1_PSS, + ECDSA, + + SIGNATURE_SCH_TYPES_NUM +}; +enum E_PUB_KEY_TYPES +{ + PUB_KEY_TYPE_RSA, + PUB_KEY_TYPE_ECDSA_NAMED_CURVE, + PUB_KEY_TYPE_ECDSA_DOMAIN_PARAMS, + + PUB_KEY_TYPES_NUM +}; + +enum E_BIT_ENCODINGS +{ + ENCODING_BIN, + ENCODING_HEX +}; + +enum E_CERTIFICATE_TYPES +{ + X509_PEM, + X509_DER, + X509_GIDS_NFC, + + E_CERTIFICATE_TYPES_NUM +}; + +enum E_ECC_CURVES +{ + secp112r1, + secp112r2, + secp128r1, + secp128r2, + secp160r1, + secp160r2, + secp160k1, + secp192r1, + prime192v2, + prime192v3, + secp192k1, + secp224r1, + secp224k1, + secp256r1, + secp256k1, + secp384r1, + secp521r1, + prime239v1, + prime239v2, + prime239v3, + brainpoolP160r1, + brainpoolP192r1, + brainpoolP224r1, + brainpoolP256r1, + brainpoolP320r1, + brainpoolP384r1, + brainpoolP512r1, + brainpoolP160t1, + brainpoolP192t1, + brainpoolP224t1, + brainpoolP256t1, + brainpoolP320t1, + brainpoolP384t1, + brainpoolP512t1, + + ECC_CURVES_NUM + + /* Not supported in uFCoder library yet: + sect113r1, + sect113r2, + sect131r1, + sect131r2, + sect163k1, + sect163r1, + sect163r2, + sect193r1, + sect193r2, + sect233k1, + sect233r1, + sect239k1, + sect283k1, + sect283r1, + sect409k1, + sect409r1, + sect571k1, + sect571r1 + */ +}; +// #define F2M_CURVES sect113r1 + +typedef struct +{ + uint8_t *serial; + uint8_t *subject; + uint8_t *issuer; + uint8_t *SKI; + uint8_t *AKI; + uint32_t serial_len; + uint32_t subject_len; + uint32_t issuer_len; + uint32_t SKI_len; + uint32_t AKI_len; +} icaoMlSearchCriteria_t; + +typedef struct +{ + uint32_t ecc_curve_field_type; + void *field_domain_params; // To be defined. For now only a named primary field curves are supported. +} ecc_curve_domain_params_t; + +typedef struct +{ + uint32_t ecc_curve_definition_type; // one of the E_ECC_CURVE_DEFINITION_TYPES + uint32_t ecc_curve_index; + char *ecc_curve_name; + ecc_curve_domain_params_t *ecc_curve_domain_params; +} ecc_key_param_t; + +enum E_MRTD_IMG_TYPE +{ + MRTD_IMG_JPEG = 0, + MRTD_IMG_JP2 = 1, + MRTD_IMG_JPEG2000 = 1, // Alias for the MRTD_IMG_JP2 + + MRTD_IMG_TYPE_UNKNOWN = 0xFFFFFFFF +}; + +typedef enum +{ + USER_PIN = 0, + SO_PIN, + USER_PUK, + SO_PUK +} dl_sec_code_t; + +enum E_PRINT_VERBOSE_LEVELS +{ + PRINT_NONE, + PRINT_ESSENTIALS, + PRINT_DETAILS, + PRINT_ALL_PLUS_STATUSES, +}; + +// SAM definition +typedef enum E_SAM_HW_VER +{ + SAM_UNKNOWN_TYPE, + SAM_T1AD2060_AV1_MODE, + SAM_T1AD2060_AV2_MODE, + SAM_T1AR1070_AV1_MODE, + SAM_T1AR1070_AV2_MODE +} SAM_HW_TYPE; + +// Reader status +typedef enum E_EMULATION_MODES +{ + TAG_EMU_DISABLED, + TAG_EMU_DEDICATED, + TAG_EMU_COMBINED, + TAG_EMU_AUTO_AD_HOC +} emul_modes_t; + +typedef enum E_EMULATION_STATES +{ + EMULATION_NONE, + EMULATION_IDLE, + EMULATION_AUTO_COLL, + EMULATION_ACTIVE, + EMULATION_HALT, + EMULATION_POWER_OFF +} emul_states_t; + +typedef enum E_PCD_MGR_STATES +{ + PCD_MGR_NO_RF_GENERATED, + PCD_MGR_14443A_POLLING, + PCD_MGR_14443A_SELECTED, + PCD_MGR_CE_DEDICATED, + PCD_MGR_CE_COMBO_START, + PCD_MGR_CE_COMBO, + PCD_MGR_CE_COMBO_IN_FIELD +} pcd_states_t; + +enum E_RGB_PORT_NAMES +{ + EXTERNAL_RGB_PORT, + INTERNAL_RGB_PORT +}; + +enum E_CUSTOM_UI_IDLE_MODES +{ + CUSTOM_UI_IDLE_MODE_NONE = 0, + CUSTOM_UI_IDLE_MODE_STATIC_LED, + CUSTOM_UI_IDLE_MODE_BLINKING_LED, + CUSTOM_UI_IDLE_MODES_NUMBER_INDICATOR +}; + +enum E_CUSTOM_UI_DETECTED_MODES +{ + CUSTOM_UI_DETECTED_MODE_NONE = 0, + CUSTOM_UI_DETECTED_MODE_STATIC_LED, + CUSTOM_UI_DETECTED_MODE_STATIC_LED_BEEP, + CUSTOM_UI_DETECTED_MODE_BEEP, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED_BEEP, + CUSTOM_UI_DETECTED_MODES_NUMBER_INDICATOR +}; + +enum E_ISO15693_PASSWORD_IDENTIFIERS +{ + PWD_READ = 0x01, + PWD_WRITE = 0x02, + PWD_PRIVACY = 0x04, + PWD_DESTROY = 0x08, + PWD_EAS_AFI = 0x10 +}; + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * @defgroup INTERNAL !!!INTERNAL!!! uFR API calls (Not for public SDK use) (remove from final revision) + * @{ + */ + /** @} */ // end of defgroup INTERNAL + + /** + * @defgroup UNDOCUMENTED UNDOCUMENTED uFR API calls (remove from final revision) + * @brief Excluded from docs due to the nature of their usage + * @{ + */ + /**@}*/ // end of defgroup INTERNAL + + /** @defgroup LibLic Library licensing + * @brief Prerequisite API calls for facilitating use of uFR MDK (Mobile Development Kit) with Android/iOS devices (usage of mobile device internal NFC antenna) + * @{ + */ + /** @} */ // end of LibLic + + /** @defgroup SingleReader Single Reader + * @{ + */ + /** @defgroup ReaderAndLibrary Reader and library + ** @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication + + /** @defgroup ReaderAndLibrary_Information Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information + + /** @defgroup ReaderAndLibrary_EEPROM EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM + + /** @defgroup ReaderAndLibrary_Signalization Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization + + /** @defgroup ReaderAndLibrary_RGBSignalization RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL. + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl Display Control + * @since uFCoder library version 6.0.5 + * + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFROnlineCommands uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands + + /** @defgroup ReaderAndLibrary_BaseHDUFR uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR + + /** @defgroup ReaderAndLibrary_NXPSAM Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM + + /** @defgroup ReaderAndLibrary_HelperFunc Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc + + /**@}*/ // end of defgroup ReaderAndLibrary + + /** @defgroup Card_Tag Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockRead(), BlockWrite(), LinearRead(), LinearWrite() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF + + /** @defgroup Card_Tag_NTAG_2XX NTAG2XX (Type 2) specific commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG + + /** @defgroup Card_Tag_NT4H NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H + + /** @defgroup Card_Tag_Mifare_Desfire Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire + + /** @defgroup Card_Tag_Mifare_Desfire_Light Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Desfire_Light + + /** @defgroup Card_Tag_Mifare_Plus Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Plus + + /** @defgroup Card_Tag_Ultralight_C Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Ultralight_C + + /** @defgroup Card_Tag_JavaCardApplication Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication + + /** @defgroup Card_Tag_CardFeatures Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4 ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4 + + /** @defgroup Card_Tag_CardFeatures_ISO7816 ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816 + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification + + /** @defgroup Card_Tag_CardFeatures_MRTD Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD + + /** @defgroup Card_Tag_CardFeatures_TLS TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS + + /** @defgroup Card_Tag_CardFeatures_EMV Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV + + /** @defgroup Card_Tag_CardFeatures_AntiCollision Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode + + /**@}*/ // end of defgroup Card_Tag_CardFeatures + + /**@}*/ // end of defgroup Card_Tag + + /** @defgroup Miscellaneous Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous + + /**@}*/ // end of defgroup SingleReader + + /** @defgroup MultiReader MultiReader + * @{ + ** @defgroup ReaderAndLibrary_ReaderList Handling multiple readers + * @brief If you want to communicate and use multiple readers from an application, you have to follow the + * initial procedure for enumerating uFR compatible devices and getting their handles + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_ReaderList + + /** @defgroup ReaderAndLibrary_M Reader and library + * @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication_M Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication_M + + /** @defgroup ReaderAndLibrary_Information_M Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information_M + + /** @defgroup ReaderAndLibrary_EEPROM_M EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM_M + + /** @defgroup ReaderAndLibrary_Signalization_M Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization_M + + /** @defgroup ReaderAndLibrary_RGBSignalization_M RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_M Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFROnlineCommands_M uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands_M + + /** @defgroup ReaderAndLibrary_BaseHDUFR_M uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR_M + + /** @defgroup ReaderAndLibrary_NXPSAM_M Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM_M + + /** @defgroup ReaderAndLibrary_HelperFunc_M Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc_M + + /**@}*/ // end of defgroup ReaderAndLibrary_M + + /** @defgroup Card_Tag_M Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General_M General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare_M Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockReadM(), BlockWriteM(), LinearReadM(), LinearWriteM() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF_M NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF_M + + /** @defgroup Card_Tag_NTAG_2XX_M NTAG2XX (Type 2) related commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG_2XX_M + + /** @defgroup Card_Tag_NT4H_M NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H_M + + /** @defgroup Card_Tag_Mifare_Desfire_M Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_M + + /** @defgroup Card_Tag_Mifare_Desfire_Light_M Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_Light_M + + /** @defgroup Card_Tag_Mifare_Plus_M Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Plus_M + + /** @defgroup Card_Tag_Ultralight_C_M Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Ultralight_C_M + + /** @defgroup Card_Tag_JavaCardApplication_M Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common_M Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common_M + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage_M DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage_M + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_M + + /** @defgroup Card_Tag_CardFeatures_M Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking_M Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking_M + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4_M ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4_M + + /** @defgroup Card_Tag_CardFeatures_ISO7816_M ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816_M + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M + + /** @defgroup Card_Tag_CardFeatures_MRTD_M Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD_M + + /** @defgroup Card_Tag_CardFeatures_TLS_M TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS_M + + /** @defgroup Card_Tag_CardFeatures_EMV_M Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV_M + + /** @defgroup Card_Tag_CardFeatures_AntiCollision_M Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision_M + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode_M Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode_M + + /**@}*/ // end of defgroup Card_Tag_CardFeatures_M + + /**@}*/ // end of defgroup Card_Tag_M + + /** @defgroup Miscellaneous_M Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous_M + + /**@}*/ // end of defgroup MultiReader + + /** @defgroup uFR_MDK uFR MDK (Mobile Development Kit) + * @since uFCoder library version 6.0.0 + * + * Using the internal NFC antenna of a mobile device is supported in the uFCoder library through the usage of ReaderOpenEx() with appropriate parameters. + * It is mandatory to obtain a valid DLogic license to make use of the uFR MDK. + * License can be obtained automatically through the ReaderOpenEx() API call. + * Or using the GetLicenseRequestData() and our online service found at: https://liblic.d-logic.com/
+ * Refer to @ref LibLic group for details. + * + * @{ + */ + /** @defgroup uFR_MDK_Android Android + * @brief uFR MDK for Android currently has support for the NTAG2XX, Mifare Classic®, Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * @{ + */ + /** @defgroup uFR_MDK_Android_NTAG2XX NTAG2XX with NDEF support + * @brief Supported API calls for NTAG2XX (e.g NTAG203/210/213/215/216) cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * read_ndef_record() + * * write_ndef_record() + * * write_ndef_record_mirroring() + * * write_ndef_record_mirroring_tt() + * * get_ndef_record_count() + * * erase_last_ndef_record() + * * erase_all_ndef_records() + * * ndef_card_initialization() + * * WriteNdefRecord_WiFi() + * * WriteNdefRecord_BT() + * * WriteNdefRecord_SMS() + * * WriteNdefRecord_Bitcoin() + * * WriteNdefRecord_GeoLocation() + * * WriteNdefRecord_NaviDestination() + * * WriteNdefRecord_Email() + * * WriteNdefRecord_Address() + * * WriteNdefRecord_AndroidApp() + * * WriteNdefRecord_Text() + * * WriteNdefRecord_StreetView() + * * WriteNdefRecord_Skype() + * * WriteNdefRecord_Whatsapp() + * * WriteNdefRecord_Viber() + * * WriteNdefRecord_Contact() + * * WriteNdefRecord_Phone() + * * ReadNdefRecord_WiFi() + * * ReadNdefRecord_Bitcoin() + * * ReadNdefRecord_GeoLocation() + * * ReadNdefRecord_NaviDestination() + * * ReadNdefRecord_Email() + * * ReadNdefRecord_Address() + * * ReadNdefRecord_AndroidApp() + * * ReadNdefRecord_Text() + * * ReadNdefRecord_StreetView() + * * ReadNdefRecord_Skype() + * * ReadNdefRecord_Whatsapp() + * * ReadNdefRecord_Viber() + * * ReadNdefRecord_Contact() + * * ReadNdefRecord_Phone() + * * ReadNdefRecord_SMS() + * * ReadNdefRecord_BT() + * * ParseNdefMessage() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_NTAG2XX + + /** @defgroup uFR_MDK_Android_Mifare Mifare Classic + * @brief Supported API calls for Mifare Classic cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * SectorTrailerWrite_PK() + * * SectorTrailerWriteUnsafe_PK() + * * ValueBlockRead_PK() + * * ValueBlockWrite_PK() + * * ValueBlockInSectorRead_PK() + * * ValueBlockInSectorWrite_PK() + * * ValueBlockIncrement_PK() + * * ValueBlockDecrement_PK() + * * ValueBlockInSectorIncrement_PK() + * * ValueBlockInSectorDecrement_PK() + * * LinearFormatCard_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Mifare + + /** @defgroup uFR_MDK_Android_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth() + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth() + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Desfire + + /** @defgroup uFR_MDK_Android_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_Android + + /** @defgroup uFR_MDK_iOS iOS + * @brief uFR MDK for IOS currently has support only for Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * + * @{ + */ + /** @defgroup uFR_MDK_iOS_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_iOS_Desfire + + + /** @defgroup uFR_MDK_IOS_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_IOS_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_iOS + + /**@}*/ // end of defgroup uFR_MDK + + //-------------------------------------------------------------------------------------------------- + /** + * @brief Used to generate license request necessary for obtaing valid uFCoder license separately. + * + * Parameter "license_request" will hold a JSON string value that is to be used for our online front-end service for generating an offline license. + * The online service is found at: https://liblic.d-logic.com/ + * + * @ingroup LibLic + * + * @param months Number of months requested for the license + * @param license_request JSON string formed with licensing parameters + * + */ + void DL_API GetLicenseRequestData(uint32_t months, OUT char *license_request); + + /** + * @brief Used to validate and store an offline Dlogic license for future usage. + * + * @ingroup LibLic + * + * @param license_str JSON string containing full license data + * + * @return Operation status + */ + UFR_STATUS DL_API SetLicenseData(c_string license_str); + + /** + * @brief Opens reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s. If you have more than one µFR Online device, ReaderOpen function will open the first one found, for the device not connected to the PC via cable, use ReaderOpenEx() instead. + *
+ * NOTE: On Android, using ReaderOpen() will establish communication with uFR Series readers connected via OTG cable. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen(void); + + /** + * @brief Opens a port of connected reader using readers family type. Useful for speed up opening for non uFR basic reader type (e.g. BaseHD with uFR support). + * + * Do not use this function for opening communication with µFR Online devices. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenByType(uint32_t reader_type); + + enum E_READER_TYPE + { + AUTO = 0, + UFR_TYPE = 1, + UFR_RS232_TYPE = 2, + BASEHD_UFR_TYPE = 3, + UFR_ONLINE_TYPE = 4, + INTERNAL_NFC = 5 + }; + + /** + * @brief Open reader communication port in several different ways. Can be used for establishing communication with COM port too. + * + * There is enumeration in uFCoder.h file called E_READER_TYPE with values: + * enum E_READER_TYPE + * { + * AUTO = 0, + * UFR_TYPE = 1, + * UFR_RS232_TYPE = 2, + * BASEHD_UFR_TYPE = 3, + * UFR_ONLINE_TYPE = 4, + * INTERNAL_NFC = 5 + * }; + * Values in this enumeration you can pass into ReaderOpenEx function as reader_type parameter.
+ * For example, if you pass 4 as reader_type it will only work with µFR Online Series devices, and then as port_name you can pass devices IP address or serial number (ex: “192.168.1.123” or “ON101390”), for port_interface you can pass ‘U’ for UDP, ‘T’ for TCP or 0. + * If you pass 0, it will automatically search for reader working mode (UDP or TCP) and open it. For argument you can pass 0 or µFR Nano device serial number to open it on 1Mbit/s (ex: “UN123456”).
+ * Using value 5 as reader_type implies usage of internal mobile device NFC. + * Upon a call to ReaderOpenEx with this parameter, the library will try to obtain license automatically via HTTP. + * On success, a valid license is stored for future use. On failure, it moves to looking up for stored licenses. Results other than UFR_OK status imply a corresponding error that occurred and as such use of internal mobile device NFC will be unavailable. + * When using 5 as reader_type, additionally you can specify port_interface parameter to decide whether to do online->offline validation or just offline. To use offline-only validation of a previously stored valid DLogic license, set port_interface to 1. + * Value 0 is default value for port_interface and implies online->offline license validation. + * More examples for port open are given in the “Reader Open Examples” document: + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-doc/blob/master/Reader_Open_Examples.pdf + * Examples: + * ReaderOpenEx(1, “COM1”, 0, 0) + * This example will open communication with µFR device attached to COM1 port on 1Mbit/s + * ReaderOpenEx(1, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR device on 1Mbit/s + * ReaderOpenEx(2, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR RS232 device on 115200 bit/s + * ReaderOpenEx(4, “ON123456”, ‘U’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on UDP protocol. + * ReaderOpenEx(4, “ON123456”, ‘T’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘U’, 0) + * This example will open communication with µFR Online reader with IP address 192.168.1.123 on UDP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘T’, 0) + * This will open communication with µFR Online reader with IP address 192.168.1.123 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, 0, 0) + * It will open communication with µFR Online reader with IP address 192.168.1.123 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, 0) + * It will open communication with µFR Online reader with serial number ON123456 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with serial number ON123456 + * ReaderOpenEx(4, “192.168.1.123”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with IP address 192.168.1.123 + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) When uFR Online reader works in BT serial mode or transparent mode, reader_type must be set to 1. + * @param port_name is c-string type used to open port by given serial name. If you provide NULL or empty string that is AUTO MODE which calls ReaderOpenEx() and all available ports on the system. serial port name, identifier, like "COM3" on Windows or "/dev/ttyS0" on Linux or "/dev/tty.serial1" on OS X or if you select FTDI, reader serial number like "UN123456", if reader have integrated FTDI interface When the UDP interface type is selected, port_name must be provided in “address:port” format. Like "192.168.1.162:8881" IP for UDP I/F + * @param port_interface type of communication interfaces (define interface which we use while connecting to the printer), supported value's: 0 : auto - first try FTDI than serial if port_name is not defined 1 : try serial / virtual COM port / interfaces 2 : try only FTDI communication interfaces 10 : try to open Digital Logic Shields with RS232 uFReader on Raspberry Pi (serial interfaces with GPIO reset) 84 ('T') : TCP/IP interface 85 ('U') : UDP interface 102 ('B'): BT serial interface. Android library only. 114 ('L'): BLE interface. Android library only. When uFR Online reader works in BT serial mode, port_interface must be set to 0 (Except Android). arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * @param arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenEx(uint32_t reader_type, IN c_string port_name, uint32_t port_interface, IN void *arg); + + /** + * @brief Opens uFR Online device by serial number. + * + * Function will open communication (UDP or TCP) with device based on its working mode. If function cannot find given serial number, it will open communication on serial port with 1Mbit/s. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param serial_number Pointer to const char array (c_string) containing devices serial number (ex. “ON101390”). + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen_uFROnline(c_string serial_number); + + /** + * @brief Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderReset(void); + + /** + * @brief Physical reset of reader communication port & tests the communication before returning a UFR_STATUS code. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetWait(void); + + /** + * @brief Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderClose(void); + + /** + * @brief This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestart(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderHwReset(void); + + /** + * @brief Used to get the FTDI D2XX driver version number. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major: Byte value indicating driver version major number + * @param version_minor: Byte value indicating driver version minor number + * @param build: Byte value indicating driver version build number + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor, VAR uint8_t *build); + + /** + * @brief Used to get the FTDI D2XX driver version number as c-string. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_str: buffer that will contain driver version as c-string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersionStr(OUT char *version_str); + + /** + * @brief Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderType(VAR uint32_t *lpulReaderType); + + /** + * @brief Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumber(VAR uint32_t *lpulSerialNumber); + + /** + * @brief Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information + * + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnected(VAR uint32_t *connected); + + /** + * @brief Store a new key or change existing key under provided index parameter. + * + * The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWrite(IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLock(IN const uint8_t *password); + + /** + * @brief Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlock(IN const uint8_t *password); + + /** + * @brief This function turns sound and light reader signals. + * + * Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignal(uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). + * + * Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolume(uint8_t sound_volume); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserData(OUT uint8_t *aucData); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExt(OUT uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 byte array containing user data + * @return Operation status + */ + UFR_STATUS DL_API WriteUserData(IN const uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 byte array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExt(IN const uint8_t *aucData); + + /** + * @brief Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). + * + * We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @ingroup Card_Tag_General + * + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardId(VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * @ingroup Miscellaneous + * + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSak(VAR uint16_t *atqa, VAR uint8_t *sak); + + /** + * @brief Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKey(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKey(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKey(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKey(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKey(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesWritten, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * The method for proving authenticity is determined by the suffix in the functions names. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKey(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKey(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKey(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKey(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKey(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKey(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKey(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. + * + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Provided Key mode (PK) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PK(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PK(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PK(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PK(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PK(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PK(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PK(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PK(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PK(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PK(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PK(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTime(VAR uint8_t *time); + + /** + * @brief Function sets the date and time into the device's RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param password pointer to the 8 bytes array containing password time pointer to the 6 bytes array containing date and time representation + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief This function is used in Common, Advance and Access Control set of functions. + * + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM. Maximal length of array is 128 bytes. + * + * Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * @param password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeSector(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeBlock(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BusAdminCardMake(uint32_t serial, IN uint8_t *password); + + /** + * @brief Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information + * + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescription(OUT uint8_t pSerialDescription[8]); + + /** + * @brief Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information + * + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumber(VAR uint8_t *build); + + /** + * @brief This function returns UID of card actually present in RF field of reader. It can handle all three known types : 4, 7 and 10 byte long UIDs. + * + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi-card (anti collision) mode: + //------------------------------------------------------------------------------ + /** + * @brief This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollision(void); + + /** + * @brief Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollision(void); + + /** + * @brief If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. + * + * Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCards(VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + /** + * @brief For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. + * + * First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * Before calling this function you have to call EnumCards() first. + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCards(OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + /** + * @brief Selects one of the cards which UID is on the actual UID list of the enumerated cards. + * + * If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCard(IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. + * + * Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCard(void); + + /** + * @brief Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatus(VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + //------------------------------------------------------------------------------ + /** + * @brief This function returns card type according to DlogicCardType enumeration. + * + * For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General + * + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardType(VAR uint8_t *lpucCardType); + + /** + * @brief This function returns card manufacturer as char* buffer (c-style string). + * + * For details, please refer to the ISO/IEC JTC1/SC17 STANDING DOCUMENT 5 + * + * @ingroup Card_Tag_General + * + * @param card_manufacturer_str manufacturer name as c_string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardManufacturer(OUT char *card_manufacturer_str); + + /** + * @brief This function returns 8 bytes of the T2T version. + * + * All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersion(OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). + * + * The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General + * + * @param lpulLinearSize pointer to variable which contain size of user data space lpulRawSize pointer to variable which contain size of total data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSize(VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * @ingroup Miscellaneous + * + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatus(OUT uint8_t *tt_message, VAR uint8_t *tt_status); + //------------------------------------------------------------------------------ + /** + * @brief Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. + * + * The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @ingroup Card_Tag + * + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalData(OUT uint8_t data[32], VAR uint32_t *len); + + /** + * @brief Function returns reader’s serialized discovery loop structure. + * + * C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetup(OUT uint8_t *setupStruct, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoop(IN const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Function returns the AID set in the reader to retrieve the mobile phone's unique ID. + * + * If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAid(OUT uint8_t *aid, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAid(IN const uint8_t *aid, uint32_t len); + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfig(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtp(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlot(uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKey(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencrypted(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKey(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZone(uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZone(uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatus(VAR uint8_t *bool_config_zone_locked, VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevision(uint8_t revision[4]); + //------------------------------------------------------------------------------ + + // uFCoder PRO MODE + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProMode(VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProMode(const uint32_t ReaderProMode); + + // QR barcode crypt algorithm + // initialization. with TB serial like 'TB123456' + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_Initialize(IN const uint8_t *TBSerialString, uint16_t job_number); + + // You must define 25 bytes array in memory for out_card_data[] + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCard(const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + enum CARD_ENCRYPTION_CODE_TYPE + { + CODE_TYPE_STANDARD, + CODE_TYPE_GROUP, + CODE_TYPE_DAILY_RANGE, // valid from, but only to_timestamp / every day + }; + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNext(const uint32_t code_type, const uint32_t from_timestamp, const uint32_t to_timestamp, + const uint32_t additional_data_size, IN const uint8_t additional_data[], + VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSN(OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSN(VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSN(OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Function returns TNF, type of record, ID and payload from the NDEF record. + * + * NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_record(uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. + * + * Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, IN uint8_t *id, + IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, VAR uint8_t *card_formated); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_tt(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, + int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. + * + * Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_count(VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, OUT uint8_t *ndef_record_array, + VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_record(uint8_t message_nr); + + /** + * @brief Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_records(uint8_t message_nr); + + /** + * @brief Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. + * + * If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initialization(void); + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + /** + * @brief Function stores a message record for NTAG emulation mode into the reader. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdef(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief This function does the same as WriteEmulationNdef() function with the addition of an AAR embedded in to the NDEF message. + * + * AAR stands for “Android Application Record”. AAR is a special type of NDEF record that is used by Google’s Android operating system to signify to an NFC phone that an explicitly defined Android Application which should be used to handle an emulated NFC tag. Android App record will be added as the 2nd NDEF record in the NDEF message. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record type_record pointer to the array containing record type type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param type_record pointer to the array containing record type + * @param type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param id pointer to the array containing record ID + * @param id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param aar pointer to the array containing AAR record + * @param aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefWithAAR(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length, IN uint8_t *aar, uint8_t aar_length); + + /** + * @brief Put the reader permanently in a NDEF tag emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStart(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStop(void); + + /** + * @brief Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStart(void); + + /** + * @brief Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). + * + * uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStart(void); + + /** + * @brief Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStop(void); + + /** + * @brief This function returns current ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParams(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief This command set ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 CombinedModeEmulationStart Function description Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. Function declaration (C language) UFR_STATUS CombinedModeEmulationStart(void); Function takes no parameters. ________________ Support for ISO14443-4 protocol + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParams(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param is_field_present value representing whehter field is present (1) or not (0) + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldState(VAR uint8_t *is_field_present); + + /** + * @brief Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommMode(void); + + /** + * @brief The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommMode(void); + + /** + * @brief Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRam(IN uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data buffer containing ram data returned + * @param addr address from which to read reader RAM + * @param data_len length of data to read from RAM + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRam(OUT uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function stores a message record for NTAG emulation mode into the reader in the RAM. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRam(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, + IN uint8_t *id, uint8_t id_length, IN uint8_t *payload, uint32_t payload_length); + + /** + * @brief Put the reader permanently in a NDEF tag in RAM emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStopRam() function), or by reader reset. Use the function GetReaderStatus to check if the reader is still in emulation mode (maybe the reader was reset for some reason). + * From library version 5.0.31, and firmware version 5.0.31 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartRam(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopRam(void); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value sets to 0. + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value stays unchangeable. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterNonResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function disables the NFC counter in the card emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterDisabled(void); + + //------------------------------------------------------------------------------ + + // GetNfcT2TVersion() returns 8 bytes (see T2T documentation): + typedef struct t2t_version_struct + { + uint8_t header; + uint8_t vendor_id; + uint8_t product_type; + uint8_t product_subtype; + uint8_t major_product_version; + uint8_t minor_product_version; + uint8_t storage_size; + uint8_t protocol_type; + } t2t_version_t; + + // NfcT2TSafeConvertVersion() returns converts version_record that returned from GetNfcT2TVersion() + // or GetNfcT2TVersionM(). Conversion is "alignment safe" + // (you don't need to pay attention on structure byte alignment): + /** + * @brief This is a helper function for converting raw array of 8 bytes received by calling GetNfcT2TVersion(). + * + * All modern T2T chips having same or very similar structure of the T2T version data represented in the uFR API by the structure type t2t_version_t: + * typedef struct t2t_version_struct { + * uint8_t header; + * uint8_t vendor_id; + * uint8_t product_type; + * uint8_t product_subtype; + * uint8_t major_product_version; + * uint8_t minor_product_version; + * uint8_t storage_size; + * uint8_t protocol_type; + * } t2t_version_t; + * This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). Conversion done by this function is "alignment safe". + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param version pointer to the structure of the t2t_version_t type which will receive converted T2T version + * @param version_record pointer to array containing 8 bytes of the raw T2T version acquired using function GetNfcT2TVersion() + * + */ + void DL_API NfcT2TSafeConvertVersion(t2t_version_t *version, const uint8_t *version_record); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignature(OUT uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], VAR uint8_t *lpucUidLen, + VAR uint8_t *lpucDlogicCardType); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExt(OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + /** + * @brief This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounter(uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounter(uint8_t counter_address, uint32_t inc_value); + + /** + * @brief This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. + * + * If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounter(VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RK(VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Provided Key mode (PK) This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PK(VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfig(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigEx(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfig(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigEx(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only. Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode idle mode value + * @param card_detection_mode card detection mode value + * @param idle_color idle color value(RGB) + * @param card_detection_color card detection color value(RGB) + * @param enabled enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfig(uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only. Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode pointer to idle mode value + * @param card_detection_mode pointer to card detection mode value + * @param idle_color pointer to idle color value(RGB) + * @param card_detection_color pointer to card detection color value(RGB) + * @param enabled pointer to enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfig(uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_number(VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, uint8_t start_hour, + uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record(uint8_t record_number, VAR uint16_t *first_reader_nr, VAR uint16_t *last_reader_nr, + VAR uint8_t *start_hour, VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_record(uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_record(uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, uint8_t begin_hour, + uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, uint8_t end_hour, + uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_record(VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, VAR uint8_t *end_month, + VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_type(uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_type(VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_duration(uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_duration(VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_duration(uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_duration(VAR uint32_t *duration); + + // swimming pool ************************************************************** + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validity(VAR int32_t *credit, VAR uint32_t *begin_year, VAR uint32_t *begin_month, + VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, + VAR uint32_t *end_year, VAR uint32_t *end_month, VAR uint32_t *end_day, + VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validity(int32_t credit, uint32_t begin_year, uint32_t begin_month, uint32_t begin_day, + uint32_t begin_hour, + uint32_t begin_minute, + uint32_t end_year, uint32_t end_month, uint32_t end_day, uint32_t end_hour, + uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_record(uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_record(uint8_t record_number, VAR uint8_t *right_record_type, OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counter(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, + uint8_t end_minute, IN uint8_t *days, uint8_t max_daily_counter); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record_type_max_daily_counter(uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, + VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days, VAR uint8_t *max_daily_counter); + + //============================================================================= + + /** + * @brief Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOn(uint16_t pulse_duration); + + /** + * @brief Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayState(uint8_t state); + + /** + * @brief Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param intercom shows that there is voltage at the terminals for intercom connection, or notss + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoState(VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControl(uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Function gets the state of the input pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param input_nr ordinal number of hardware specific input pin input_state input state 1 or 0. + * @param input_state input state 1 or 0. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetInputState(uint8_t input_nr, VAR uint8_t *input_state); + + /** + * @brief This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControl(uint8_t light_status); + + /** + * @brief For classic uFR PLUS devices only. The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. + * + * This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControl(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Sets the color of the RGB diodes. + * + * This color stays on the RGB diodes until the function GreenLedBlinkingTurnOn() is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity(). + * Before this function call, the function GreenLedBlinkingTurnOff() must be called, or the reader is already in mode of blocking automatic signalization. + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControl(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControl(uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes. + * + * This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleep(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. + * + * In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. + * Function also sets the number of omitted activity periods, when the RGB light is off. + * For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriod(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSet(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefault(void); + + /** + * @brief The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. + * + * Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMax(uint8_t bad_select_nr_max); + + /** + * @brief The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMax(VAR uint8_t *bad_select_nr_max); + + /** + * @brief Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepMode(void); + + /** + * @brief Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepMode(void); + + /** + * @brief Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSet(uint8_t seconds_wait); + + /** + * @brief Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGet(VAR uint8_t *seconds_wait); + + /** + * @brief This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanently(unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParameters(VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. + * + * Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. + * The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. + * For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayData(IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Function has the same functionality as the function SetDisplayData(). New feature is the RGB port selection. + * + * Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbData(IN uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequency(uint16_t frequency); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * SetRgbIntensity()(alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * GetRgbIntensity (alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensity(VAR uint8_t *intensity); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRgbIntensity(VAR uint8_t *intensity); + // DESFIRE functions ************************************************************** + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode(void); + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATS(OUT uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorage(void); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceive(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint32_t *ufr_status); + + /** + * @brief Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Transceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, uint8_t data_out_len, + OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, uint8_t send_le, + OUT uint8_t *apdu_status); + + /** + * @brief Sends C–APDU in the c_string (zero terminated) format, containing pairs of the hexadecimal digits. + * + * Pairs of the hexadecimal digits can be delimited by any of the punctuation characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu C-APDU hexadecimal c_string + * @param r_apdu Received R-APDU as a hexadecimal c_string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceive(IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are sent and receive in the form of the byte arrays. + * + * There is obvious need for a c_apdu_len and *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceive(IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @param c_apdu array containing C_APDU + * @param c_apdu_len length of C_APDU + * @param r_apdu buffer that will store R_APDU + * @param r_apdu_len returns length of R_APDU + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeap(IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief This is “exploded binary” alternative function intended for support APDU commands in ISO 14443-4A tags. + * APDUTransceive() receives separated parameters which are an integral part of the C– APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls cls + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, uint32_t Nc, + OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chain(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint8_t *rcv_chained, + VAR uint32_t *ufr_status); + + /** + * @brief R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceive(uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselect(uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * @ingroup UNDOCUMENTED + * + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive(uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, uint8_t crypto1, + uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Function sets the parameters for transceive mode. + * + * If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_start(uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stop(void); + + /** + * @brief Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enable(void); + + /** + * @brief The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending rcv_data pointer to data array received from card bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceive(IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, uint32_t bytes_to_receive, + VAR uint32_t *rcv_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interface(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_Generic(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interface(void); + + /** + * @brief Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDU(void); + + /** + * @brief Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4(void); + + /** + * @brief Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interface(void); + + /** + * @brief APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interface(void); + + //============================================================================== + /** + * @brief Using this function you can select the appropriate application on the card. + * + * For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAid(IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief In JCApp cards you can put two types of asymmetric crypto keys. + * + * Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKey(uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + IN const uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPair(uint8_t key_type, uint8_t key_index, uint8_t key_designator, uint16_t key_bit_len, + IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPair(uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPair(uint8_t key_index); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBegin(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *chunk, + uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdate(IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEnd(VAR uint16_t *sig_len); + + /** + * @brief This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignature(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *plain_data, + uint16_t plain_data_len, VAR uint16_t *sig_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Finally, to get a signature, you have to call JCAppGetSignature(). + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior calling of this function you have to be logged in with an User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig Pointer to an array of “sig_len” bytes length. Value of the “sig_len” you've got as a parameter of the JCAppSignatureEnd() or JCAppGenerateSignature() functions. You have to allocate those bytes before calling this function. + * @param sig_len Length of the allocated bytes in a sig array. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetSignature(OUT uint8_t *sig, uint16_t sig_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObj(uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, uint8_t id_size); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubject(uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Using this function you can delete certificate objects from a card. + * + * This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCert(uint8_t obj_type, uint8_t obj_index); + + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjId(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubject(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObj(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + /** + * + * @ingroup Card_Tag_JavaCardApplication + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + c_string DL_API JCAppGetErrorDescription(UFR_STATUS apdu_error_status); + + /** + * @brief This function is used to login to the JCApp with an appropriate PIN code. + * + * Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. JCAppGetPinTriesRemaining Function description This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. This function have parameter of the type dl_sec_code_t which is defined as: typedef enum { USER_PIN = 0, SO_PIN, USER_PUK, SO_PUK } dl_sec_code_t; + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLogin(uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemaining(dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t. + * + * Which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code. + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChange(dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief This function is used to unblock PIN code which is specified by the SO parameter. + * + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblock(uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKey(uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, OUT uint8_t *exponent, + VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKey( + uint8_t key_index, OUT uint8_t *keyW, + VAR uint16_t *keyWSize, + OUT uint8_t *field, VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, VAR uint16_t *g_size, + OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBits(uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + //------------------------------------------------------------------------------ + /** + * @brief This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. + * + * Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list_size ointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSize(VAR uint32_t *list_size); + + /** + * @brief After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFiles(OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief This function returns file size indexed by the parameter card_file_index, on successful execution. + * + * Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file which size we want to get. + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSize(uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFile(uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief This function reads a file from the DLStorage card directly to the new file on the host file-system. + * + * If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. + * + * Parameter data_size defines the amount of data to be written in the file on the DLStorage card. + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFile(uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief This function writes file content from the host file-system to the new file on the DLStorage card. + * + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief After successful call to this function, the file on the DLStorage card will be deleted. + * + * Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFile(uint8_t file_index); + //------------------------------------------------------------------------------ + /** + * @brief This function is used to get hash output length in bytes for specified hash algorithms. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator for which we want to get output length in bytes. Use values declared in E_HASH_ALGS enumeration. + * @param out_byte_len After successful function execution, the variable on which this pointer points to, will contain output hash length in bytes for specified hash algorithm. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashOutputByteLength(uint32_t hash_algo, VAR uint32_t *out_byte_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions) + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHash(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, OUT uint8_t *hash, uint32_t hash_alocated); + + /** + * @brief This function calculates and returns the hash of the data in the buffer pointed by the “in” function parameter. + * + * Hash algorithm is specified by the hash_algo function parameter. + * If output bytes don't match with hash_alocated function parameter function returns CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH status. + * GetHashToHeap() automatically allocates memory, which *hash parameter will point to after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used for calculation. Use values declared in E_HASH_ALGS enumeration. + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions). + * @param hash After successful function execution, the variable on which this pointer points to, will contain the pointer to the output hash. + * @param hash_len After successful function execution, the variable on which this pointer points to, will contain output hash length. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashToHeap(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, VAR uint8_t **hash, VAR uint32_t *hash_len); + + /** + * @brief This function is used in conjunction with DLHashUpdateChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() has to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used in the following hashing sequence. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashInitChunked(uint32_t hash_algo); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param in One of the chunks of data of which hash is calculated. + * @param in_len Chunk length in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashUpdateChunked(IN const uint8_t *in, uint32_t in_len); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunked(OUT uint8_t *hash, uint32_t hash_alocated); + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * DLHashFinishChunkedToHeap() automatically allocates memory, which *hash parameter will point to, after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunkedToHeap(OUT uint8_t **hash, VAR uint32_t *hash_alocated); + + /** + * @brief This function is used to verify the digital signature of the pre-hashed value or some relatively short plain text message. + * + * If there is no errors during the verification process and digital signature correspond to the "To Be Signed" (TBS) data array and public cryptographic key, the function returns UFR_OK status. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * In case of wrong digital signature, function returns CRYPTO_SUBSYS_WRONG_SIGNATURE status. + * Function can return following status codes in case of various errors: + * * CRYPTO_SUBSYS_NOT_INITIALIZED + * * CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS + * * CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS + * * CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE + * * CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR + * For digest_alg use one of the values declared in E_SIGNER_DIGESTS enumeration: + * enum E_SIGNER_DIGESTS { + * ALG_NULL = 0, + * ALG_SHA, + * ALG_SHA_256, + * ALG_SHA_384, + * ALG_SHA_512, + * ALG_SHA_224, + * ALG_SHA_512_224, + * ALG_SHA_512_256, + * SIG_DIGEST_MAX_SUPPORTED + * }; + * ALG_SHA is the designator for the SHA-1 algorithm. + * For padding_alg use one of the values declared in E_SIGNER_RSA_PADDINGS enumeration: + * enum E_SIGNER_RSA_PADDINGS { + * PAD_NULL = 0, + * PAD_PKCS1_V1_5, + * PAD_PKCS1_PSS, + * SIG_PAD_MAX_SUPPORTED + * }; + * PAD_PKCS1 is an alias of the PAD_PKCS1_V1_5 padding algorithm: + * #define PAD_PKCS1 PAD_PKCS1_V1_5 + * For cipher_alg use one of the values declared in E_SIGNER_CIPHERS enumeration: + * enum E_SIGNER_CIPHERS { + * SIG_CIPHER_RSA = 0, + * SIG_CIPHER_ECDSA, + * SIG_CIPHER_MAX_SUPPORTED + * }; + * When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * + * @ingroup Card_Tag_CardFeatures_DigitalSignatureVerification + * + * @param digest_alg in the E_SIGNER_DIGESTS enumeration. + * @param padding_alg in the E_SIGNER_RSA_PADDINGS enumeration. When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * @param cypher_alg in the E_SIGNER_CIPHERS enumeration. tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * @param tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param signature Pointer to the signature array. + * @param signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. + * @param sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). + * @param pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. + * @param pub_key_params_len Length of the additional public key parameters (in bytes). + * + * @return Operation status + */ + UFR_STATUS DL_API DigitalSignatureVerifyHash(uint32_t digest_alg, uint32_t padding_alg, uint32_t cypher_alg, IN const uint8_t *tbs, + uint32_t tbs_len, IN const uint8_t *signature, uint32_t signature_len, + IN const void *sig_params, uint32_t sig_params_len, IN const uint8_t *pub_key, + uint32_t pub_key_len, IN const void *pub_key_params, uint32_t pub_key_params_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetHashName(uint32_t hash_algo); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the ECC curve designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param eccCurve ECC curve designator. Use values declared in E_ECC_CURVES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetEccCurveName(uint32_t eccCurve); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the signature scheme (signature algorithm) designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param signatureScheme Signature scheme (signature algorithm) designator. Use values declared in E_SIGNATURE_SCHEMES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetSignatureSchemeName(uint32_t signatureScheme); + + /** + * @brief Release the memory allocated from some of the library functions previously called making it available again for further allocations. + * + * Use to deallocate i.e. cleanup memory on the heap allocated. This function is a so-called helper for programming languages other than C/C++ where you can use a free(ptr) instead. Use only after calling the library functions for which it is explicitly indicated in this manual. Function returns nothing. After successful function execution ptr will point to NULL. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param ptr Pointer to the memory allocated on the heap which you want to release. If ptr does not point to a block of memory allocated with the library functions, it causes undefined behavior. If ptr is NULL, the function does nothing. Digital signature verification Enumerations, types and structures for use with DigitalSignatureVerifyHash function enum E_ECC_CURVE_DEFINITION_TYPES { ECC_CURVE_INDEX, ECC_CURVE_NAME, ECC_CURVE_DOMAIN_PARAMETERS, ECC_CURVE_DEFINITION_TYPES_NUM }; + * + */ + void DL_API DLFree(void *ptr); + //------------------------------------------------------------------------------ + /** + * @brief Initializes MRTD reader session using MRZ data. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number 9-character document number. + * @param birth_date 6-character birth date in "YYMMDD". + * @param expiry_date 6-character expiry date in "YYMMDD". + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SessionInit(IN const char *doc_number, IN const char *birth_date, IN const char *expiry_date); + + /** + * @brief Reads MRTD document data and returns it in JSON format. + * data includes name, surname, nationality, document number, inmage in base64 and more. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param json_buffer Buffer in which the JSON is stored, recommended size is 8192 mainly because of different possible image formats stored and their size. + * @param json_size Size of the buffer in which the JSON will be stored. Requires initial length to reflect the buffer and to be large enough to store the final JSON. + * On UFR_OK the value will be the actual size of JSON stored. UFR_BUFFER_OVERFLOW indicates that the buffer size was insufficient to store the JSON. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_ReadDocumentData(OUT char *json_buffer, VAR uint32_t *json_size); + + /** + * @brief Closes the MRTD session. This function should be called after MRTD_ReadDocumentData() function. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SessionClose(); + + /** + * @brief Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBac(IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], + VAR uint64_t *send_sequence_cnt); + + /** + * @brief Use this function to read files from the eMRTD NFC tag. + * + * You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param file_index Parameter that specifies the file we want to read from the eMRTD. This is a pointer to byte array containing exactly two bytes designating eMRTD file. Those two bytes are file identificator (FID) and there is a list of FIDs: EF.COM = {0x01, 0x1E} EF.DG1 = {0x01, 0x01} EF.DG2 = {0x01, 0x02} EF.DG3 = {0x01, 0x03} EF.DG4 = {0x01, 0x04} EF.DG5 = {0x01, 0x05} EF.DG6 = {0x01, 0x06} EF.DG7 = {0x01, 0x07} EF.DG8 = {0x01, 0x08} EF.DG9 = {0x01, 0x09} EF.DG10 = {0x01, 0x0A} EF.DG11 = {0x01, 0x0B} EF.DG12 = {0x01, 0x0C} EF.DG13 = {0x01, 0x0D} EF.DG14 = {0x01, 0x0E} EF.DG15 = {0x01, 0x0F} EF.DG16 = {0x01, 0x10} EF.SOD = {0x01, 0x1D} + * @param output After the successful call to this function, this pointer will point to the pointer on the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated during function execution. Maximum amount of data allocated can be 32KB. There is a programmer responsibility to cleanup allocated data (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * @param output_length After the successful call to this function, this pointer is pointed to the size of the file data read from an eMRTD file specified by the file_index parameter. + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeap(IN const uint8_t file_index[2], VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Extracts Document Signing (DS) certificate in ASN.1 DER format from SOD. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param[out] cert A pointer to a uint8_t pointer. This will point to the allocated memory containing the + * certificate (ASN.1 DER format). The user is responsible for freeing this memory using DLFree() + * after use. + * @param[out] certlen A pointer to a uint32_t that will store the length of the certificate. + * @param[in] ksenc A uint8_t array of size 16 containing the encryption key. + * @param[in] ksmac A uint8_t array of size 16 containing the MAC key. + * @param[in,out] send_sequence_cnt A pointer to a uint64_t that keeps track of the send sequence counter. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SOD_CertToHeap(VAR uint8_t **cert, VAR uint32_t *certlen, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief This function validates data groups read from the eMRTDocument. + * + * All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function.\ + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidate(IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, uint32_t verbose_level, + OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, you can call this function and pass it null terminated strings containing document number, document holder date of birth and document expiration date. + * + * After successful function execution MRZ Proto Key will be stored in a mrz_proto_key 25-byte array. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number Pointer to a null terminated string containing exactly 9 characters document number. + * @param date_of_birth Pointer to a null terminated string containing exactly 6 characters representing the date of birth in the “YYMMDD” format. + * @param date_of_expiry Pointer to a null terminated string containing exactly 6 characters representing expiration date in the “YYMMDD” format. + * @param mrz_proto_key This byte array will contain a calculated MRZ proto-key after successful function execution. This array must have allocated at least 25 bytes prior to calling this function. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_MRZDataToMRZProtoKey(IN const char *doc_number, IN const char *date_of_birth, IN const char *date_of_expiry, + OUT uint8_t mrz_proto_key[25]); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, in the case of the TD3 MRZ format (88 totally character long), you can call this function and pass it a null terminated string containing the MRZ subjacent row. + * + * Example of the TD3 MRZ format printed on the eMRTD document looks like this: + * P File 2, and overwrites the contents with data provided + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param data Array containing NDEF message data stored in a buffer to be written + * @param data_length length of the data to be written + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFMessage(IN uint8_t *data, uint32_t data_length); + + /** + * @brief Function used to read the whole NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param message pointer to array that will hold message data + * @param message_length length of the message that was read if successfull + * + * @return Operation status + */ + + UFR_STATUS DL_API uFR_int_DesfireReadNDEFMessage(OUT uint8_t *message, uint32_t *message_length); + /** + * @brief Function used to extract the payload of the NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param payload_str pointer to buffer that will hold payload data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadNDEFPayload(OUT char *payload_str); + + /** + * @brief Function used to write the payload of the NDEF message on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * The function takes in only c-string URI, and sets it's uri_identifier to 0 so it is not prefixed by anything when read. + * + * @param payload_str pointer to buffer that will hold message data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFPayload(IN c_string payload_str); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief The function allows the blinking of the green diode independently of the user's signaling command (default setting). + * + * This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOn(void); + + /** + * @brief The function prohibits the blinking of the green diode independently of the user's signaling command. + * + * LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOff(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOn(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOff(void); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeA(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeB(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212Default(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424Default(void); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeA(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeB(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t CWGsNOff, + uint8_t ModGsNOff); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API FastFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParameters(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrate(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersPN7462(OUT uint8_t *die_id, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, VAR uint8_t *fw_ver_build); + + // SAM + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_raw(OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version(VAR SAM_HW_TYPE *sam_type, OUT uint8_t *sam_uid); + + /** + * @brief Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_raw(uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param key_no key_no + * @param key_v key_v + * @param des_key des_key + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_des(uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * @ingroup UNDOCUMENTED + * + * @param aes_key_ver_a aes_key_ver_a + * @param ver_a ver_a + * @param aes_key_ver_b aes_key_ver_b + * @param ver_b ver_b + * @param aes_key_ver_c aes_key_ver_c + * @param ver_c ver_c + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_key(IN uint8_t *aes_key_ver_a, uint8_t ver_a, IN uint8_t *aes_key_ver_b, + uint8_t ver_b, IN uint8_t *aes_key_ver_c, uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param master_aes_key master_aes_key + * @param key_version key_version + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_mode(IN uint8_t *master_aes_key, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. + * + * A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plain(IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *keyA, IN uint8_t *keyB, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Ultralight C card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 8 bytes of DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_key(uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + uint8_t sam_lock_unlock, uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKey(uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeable(void); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfReset(void); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOn(void); + + /** + * @brief Function switch off RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderId(IN uint8_t *reader_id); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReader(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderUsb(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderStreamUsb(IN uint8_t *data, uint16_t packet_nr); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BootReader(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_CodeProtect(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParams(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParamsUsb(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_Test(uint8_t param); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdCalibration(uint8_t lpcd_threshold, OUT uint16_t *lpcd_reference); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdPerform(uint8_t lpcd_threshold, uint16_t lpcd_reference, VAR uint16_t *lpcd_agc, VAR uint8_t *lpcd_status); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOn(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ExtField(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ESP32_boot_init(IN uint8_t *reader_cnt, uint8_t reader_nr); + + // MIFARE PLUS + /** + * @brief Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePerso(uint16_t address, IN uint8_t *data); + + /** + * @brief Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPerso(void); + + /** + * @brief Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param card_master_key card_master_key + * @param card_config_key card_config_key + * @param level_2_switch_key level_2_switch_key + * @param level_3_switch_key level_3_switch_key + * @param level_1_auth_key level_1_auth_key + * @param select_vc_key select_vc_key + * @param prox_chk_key prox_chk_key + * @param vc_poll_enc_key vc_poll_enc_key + * @param vc_poll_mac_key vc_poll_mac_key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimal(IN uint8_t *card_master_key, IN uint8_t *card_config_key, IN uint8_t *level_2_switch_key, + IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, IN uint8_t *select_vc_key, + IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key); + + /** + * @brief Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current master key *new key pointer to 16 byte array containing the new master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new master key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new configuration key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) *configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PK(IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKey(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Key B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key_index new_key_index + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index, uint8_t new_key_type); + + /** + * @brief + * ADD DESCRIPTION + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param old_key old_key + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * @brief Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKey(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PK(IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key_index pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief + * Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PK(IN uint8_t *key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth_internal(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key_internal(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_internal(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceGet(uint32_t auth_mode, IN void *auth_value, VAR int32_t *credit); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceSet(uint32_t auth_mode, IN void *auth_value, int32_t credit); + + /** + * @brief This function sets communication speed (UART baud rate). + * + * Allowed values of baud rate are: 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, and 1000000 bps. All RS232 devices are supported, and USB devices (Nano FR, Classic) from firmware version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param baud_rate UART baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API SetUartSpeed(uint32_t baud_rate); + + /** + * @brief This function returns communication speed (UART baud rate) to default value. + * + * For RS23 devices default communication speed is 115200 bps, and for USB devices is 1000000 bps. + * For RS232 devices from version 5.0.1 (plus devices), and for USB devices from version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 1 - USB 2 - RS232 + * @param comm_type 1 - COM port 2 - FTDI + * @param port_name If comm_type is FTDI enter empty string If comm_type is COM port Windows “COMx” Linux “/dev/ttyUSBx” Mac OS “/dev/tty.usbserial-xxxxxxxx” + * + * @return Operation status + */ + UFR_STATUS DL_API SetDefaultUartSpeed(uint8_t reader_type, uint8_t comm_type, IN c_string port_name); + + // NT4H + /** + * @brief Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. + * + * This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parameters(uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Provided Key mode (PK) The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit read_ctr_limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Provided Key mode (PK) Function enables card Random ID. + * + * Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pk(IN uint8_t *aes_key_ext); + UFR_STATUS DL_API nt4h_unset_rid_pk(IN uint8_t *aes_key_ext); + + /** + * @brief Function enables card Random ID. Authentication with application master key (key number 0) required. + * + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid(uint8_t aes_key_no); + + /** + * @brief Provided Key mode (PK) Function returns card UID if Random ID activated. + * + * Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid(uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Provided Key mode (PK) Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pk(IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key(uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Provided Key mode (PK) Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pk(IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr(uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief No authentication. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_auth(uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Helper function for the MAC of SDM checking. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param mac_in_data data from mac_input_offset to mac_offset + * @param mac_in_len mac_input_offset - mac_offset + * @param sdm_mac pointer to array contained 8 bytes SDM MAC + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_check_sdm_mac(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *mac_in_data, IN uint8_t mac_in_len, IN uint8_t *sdm_mac); + + /** + * @brief Helper function for decryption of encrypted file data. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param enc_file_data pointer to array contained encrypted part of file data + * @param enc_file_data_len length of encrypted part of file data + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_sdm_enc_file_data(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *enc_file_data, IN uint8_t enc_file_data_len); + + /** + * @brief Helper function for decryption of encrypted PICC data. + * + * Function returns UID and SDM reading counter. Users need to know the AES key for metadata read (PICC data). + * + * @ingroup Card_Tag_NT4H + * + * @param picc_data pointer to array contained encrypted PICC data + * @param auth_key pointer to array contained AES meta data read key + * @param picc_data_tag if bit 7 set exist UID mirroring if bit 6 set exist SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param smd_read_cnt pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_picc_data(IN uint8_t *picc_data, IN uint8_t *auth_key, IN uint8_t *picc_data_tag, IN uint8_t *uid, IN uint32_t *smd_read_cnt); + + /** + * Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature(uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pk(IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status(uint8_t aes_key_no, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_auth(VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pk(IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt(uint8_t aes_key_no, uint8_t tt_status_key_no); + + // Desfire light + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param file_type file type 0 - standard data file, 2 - value file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param free_get_value value file get value without authentication (0 - disabled, 1 - enabled) + * @param record_size cyclic record file size of record + * @param max_number_of_rec cyclic record file maximal number of record + * @param curr_number_of_rec cyclic record file number of used record + * @param ex_unauth_operation TMC file exclude unauthorized operation + * @param tmc_limit_conf TMC file limit configuration + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param tmc_limit TMC file counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, VAR uint8_t *free_get_value, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *ex_unauth_operation, VAR uint8_t *tmc_limit_conf, VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, VAR uint32_t *tmc_limit); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered read_key_no read key number (0 - 4) write_key_no write key number (0 - 4) read_write_key_no read write key number (0 - 4) change_key_no change key number (0 - 4) + * @param key_no DESCRIPTION + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no currnent change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Function changes file settings of the Transaction MAC file. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no aes_key_no + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * @ingroup UNDOCUMENTED + * + * @param aes_key_ext aes_key_ext + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * @brief + * From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pk(IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file(uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in credit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of credit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_credit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in debit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of debit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_debit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in clear record operation. Function also returns decrypted Previous Reader ID. Users must enter file number, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_clear_record_transaction_mac(uint8_t file_no, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + // reader + /** + * @brief Function returns various reader states. + * + * From library version 5.0.31 and firmware version 5.0.33 + * The reader states are defined into following structures. This function is useful for checking if the reader is still in emulation mode after calling the TagEmulationStartRam() function. + * typedef enum E_EMULATION_MODES { + * TAG_EMU_DISABLED, + * TAG_EMU_DEDICATED, + * TAG_EMU_COMBINED, + * TAG_EMU_AUTO_AD_HOC + * }emul_modes_t; + * typedef enum E_EMULATION_STATES + * { + * EMULATION_NONE, + * EMULATION_IDLE, + * EMULATION_AUTO_COLL, + * EMULATION_ACTIVE, + * EMULATION_HALT, + * EMULATION_POWER_OFF + * }emul_states_t; + * typedef enum E_PCD_MGR_STATES + * { + * PCD_MGR_NO_RF_GENERATED, + * PCD_MGR_14443A_POLLING, + * PCD_MGR_14443A_SELECTED, + * PCD_MGR_CE_DEDICATED, + * PCD_MGR_CE_COMBO_START, + * PCD_MGR_CE_COMBO, + * PCD_MGR_CE_COMBO_IN_FIELD + * }pcd_states_t; + * + * @ingroup Miscellaneous + * + * @param state - normal working mode states are PCD_MGR_NO_RF_GENERATED or PCD_MGR_14443A_POLLING or PCD_MGR_14443A_SELECTED. - NTAG emulation mode state is PCD_MGR_CE_DEDICATED emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderStatus(VAR pcd_states_t *state, VAR emul_modes_t *emul_mode, VAR emul_states_t *emul_state, VAR uint8_t *sleep_mode); + + // EMV FUNCTIONS + + /** + * @brief Used for extracting the credit card PAN number. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param pan_str Pointer to char array containing credit card PAN. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetPAN(IN c_string df_name, OUT char *pan_str); + + /** + * @brief Used for extracting details about the last transaction stored in a credit card. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param last_transaction_info Pointer to char array containing details about the last transaction stored in the card. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetLastTransaction(IN c_string df_name, OUT char *last_transaction_info); + + + /** + * @brief Function is used for extracting image pixel values and storing them in the display for later use. This function will not render the image to the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param gallery_index - where in displays memory to store the bitmap(0-10) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveBitmapToGallery(const char *filename, int gallery_index); + + /** + * @brief Function takes an image and extracts it's pixel values and then just renders the on the display without storing the bitmap in the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param timeout - how long the bitmap should stay on display, 0-is indefinitely + * @param positionX - where on the display to start the bitmap. + * @param positionY - where on the display to start the bitmap. + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmap(const char *filename, uint32_t timeout, int positionX, int positionY); + + /** + * @brief Function renders an image that is stored in the display gallery. The gallery consist of 15 slots, of those 15 - 10 are used for storing bitmaps and the other 4 (11-15) are SystemBitmaps used by the display. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param gallery_index - which slot from the gallery to render on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmapFromGallery(int gallery_index); + + /** + * @brief Function allows you to change the essential symbols that the display regularly uses. These symbols include the Boot Image (ID-15), the Check bitmap(ID-14), and the Cross bitmap (ID-13). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param system_bitmap_index - ID of which system bitmap to change or import new (if slot is free 11-12) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveSystemBitmap(const char *filename, int system_bitmap_index); + + /** + * @brief Function renders the last image that was called with the function Display_ShowBitmap() + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowLastUnsavedImage(); + + /** + * @brief Function is used for communicating with the uFR device via I2C in COM protocol format. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param cmd - Command packet (read the "COM protocol" for more information) + * @param cmd_ext - Command extended packet, if cmd_ext is not being sent then should be "NULL" + * @param rsp - Array where the response will be written (at least 7 bytes) + * @return Operation status + */ + UFR_STATUS DL_API Display_Transmit(uint8_t *cmd, uint8_t *cmd_ext, uint8_t *rsp); + + /** + * @brief Function displays custom text on the screen. It can also enable text scrolling, position the text at a specific location on the display, and adjust the font size and style + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param customText - pointer to a string text + * @param fontStyle - number to change font style (0-1; 0 - default; 1 - not implemented) + * @param fontSize - number to change font size (0-1; 0 - 8x8 pixels; 1 - 16x16 pixels) + * @param scrollEnable - number to enable scroll (0-1) + * @param positionX - number containing X cordinate to place the text + * @param positionY - number containing Y cordinate to place the text + * @return Operation status + */ + UFR_STATUS DL_API Display_PrintText(const char *customText, int fontStyle, int fontSize, int scrollEnable, int positionX, int positionY); + + /** + * @brief Function displays a chec or a cross bitmap and, if a speaker is connected to the display, it triggers a function that produces a beep sound + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param signal - number to display a check or a cross symbol on the display (1-2; 1-cross; 2-check) + * @return Operation status + */ + UFR_STATUS DL_API Display_UserInterfaceSignal(int signal); + + /** + * @brief Function writes the time on the display. If the display is not connected to the Reader, the time will be displayed and remain unchanged. However, if the display is connected to the Reader, the time will be shown only for a second because the Reader is sending the correct time to the display every second. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param hour - number that represents the hour that will be drawn on the display + * @param minute - number that represents the minute that will be drawn on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowTime(int hour, int minute); + + /** + * @brief Function clears a specified section of the display. If xPosEND or yPosEND are set to 0, the function will automatically assume that the end postion for erasing extends to the edge of the screen (i.e., xPosEND will default to the display's maximum width, and yPosEND will default to it's maximum height). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param xPos - number containing X coordinate to clear on the display, start position + * @param xPosEND - number containing X coordinate to clear on the display, end position + * @param yPos - number containing Y coordinate to clear on the display, start position + * @param yPosEND - number containing Y coordinate to clear on the display, end position + * @return Operation status + */ + UFR_STATUS DL_API Display_EraseSection(int xPos, int xPosEND, int yPos, int yPosEND); + + /** + * @brief Function sets service data into EEPROM. Only use with production firmware. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param data pointer to array of 5 bytes which contains new service data + * @return Operation status + */ + UFR_STATUS DL_API SetServiceData(IN uint8_t *data); + + /** + * @brief Function gets service data from EEPROM. Use in diagnostic tool. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param data pointer to array which contains service data + * @return Operation status + */ + UFR_STATUS DL_API GetServiceData(OUT uint8_t *data); + + /** + * @brief Function gets number and types of the installed I2C devices at the reader + * @since uFCoder library version 6.0.18 + * + * @ingroup INTERNAL + * @param dev_num number of I2C devices found + * @param dev_bits bit array that represents types of I2C devices + * @return Operation status + */ + UFR_STATUS DL_API GetI2cDevicesStatus(uint8_t *dev_num, uint32_t *dev_bits); + + /** + * @brief Function gets lock status of the reader + * @since uFCoder library version 6.0.19 + * + * @ingroup INTERNAL + * @param lock_status + * @return Operation status + */ + UFR_STATUS DL_API GetReaderLockStatus(uint8_t *lock_status); + + /** + * @brief Function changes password at the NXP ICODE cards (provided passwords) + * @since uFCoder library version 6.0.13 + * + * @ingrup + * @param pwd_ident - Password Identifier + * @param current_password - pointer to the 4 bytes array that represents current password + * @param new_password - pointer to the 4 bytes array that represents new password + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password_PK(uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); + + /** + * @brief Function changes password at the NXP ICODE cards (reader's passwords) + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param pwd_ident - Password Identifier + * @param current_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @param new_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password(uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page_PK(IN uint8_t *read_password, IN uint8_t *write_password, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page(uint8_t read_pass_index, uint8_t write_pass_index, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function locks permanently the requested block on the ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API iso15693_lock_block_no_auth(uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block_PK(IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block(uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); + + /** + * @brief Function read the security status of the blocks from ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param first_block - address of the first block for security status reading + * @param number_of_blocks - number of blocks for security status reading + * @param block_data - pointer to the array of blocks security status (1 - block locked, 0 - block not locked). + * @return Operation status + */ + UFR_STATUS DL_API iso15693_get_multiply_block_security_status(uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + // XXX: Support for multiple readers with same DLL + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + + //-------------------------------------------------------------------------------------------------- + + ///--------------------------------------------------------------------- + /** + * @brief This is the first function in the order for execution for the multi-reader support. + * The function prepares the list of connected uF-readers to the system and returns the number of list items - number of connected uFR devices. + * ReaderList_UpdateAndGetCount() scans all communication ports for compatible devices, probes open readers if still connected, if not close and marks their handles for deletion. If some device is disconnected from the system this function should remove its handle. + * As of uFCoder version 5.0.73, this function probes both FTDI & COM devices and tries to open them. + * Each call to this method will close previously opened devices by this function, scan, and open everything found. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param NumberOfDevices how many compatible devices are connected to the system + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_UpdateAndGetCount(VAR int32_t *NumberOfDevices); + + /** + * @brief Used to retrieve information about a reader found & connected via ReaderList_UpdateAndGetCount(). + * This should be executed for each device based on number of devices found, providing valid index. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex index of the device in the readers list + * @param DeviceHandle assigned Handle + * @param DeviceSerialNumber device serial number + * @param DeviceType device type - device identification in AIS database + * @param DeviceFWver version of firmware + * @param DeviceCommID device identification number (master) + * @param DeviceCommSpeed communication speed + * @param DeviceCommFTDISerial FTDI COM port identification + * @param DeviceCommFTDIDescription FTDI COM port description + * @param DeviceIsOpened is Device opened + * @param DeviceStatus actual device status + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetInformation( // + uint32_t DeviceIndex, // index of the device to get information from + VAR UFR_HANDLE *DeviceHandle, //// assigned Handle + OUT c_string *DeviceSerialNumber, //// device serial number + VAR int *DeviceType, //// device type - device identification in AIS database + OUT c_string *DeviceFWver, //// version of firmware + VAR int *DeviceCommID, //// device identification number (master) + VAR int *DeviceCommSpeed, //// communication speed + OUT c_string *DeviceCommFTDISerial, //// FTDI COM port identification + OUT c_string *DeviceCommFTDIDescription, //// FTDI COM port description + VAR int *DeviceIsOpened, //// is Device opened + VAR int *DeviceStatus //// actual device status + ); + + /** + * @brief Force handle deletion when you identify that the reader is no longer connected, and want to release the handle immediately. If the handle exists in the list of opened devices, function would try to close communication port and destroy the handle. + * When uFR reader is disconnected, ReaderList_UpdateAndGetCount() will do that (destroy) automatically in next execution. + * + * @param DeviceHandle The handle that will be destroyed + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Destroy(UFR_HANDLE *DeviceHandle); + + /** + * @brief This method is used for manual addition of uFR devices to the list. Parameters used are the same as in ReaderOpenEx() method. Use this method if the device was not previously discovered by the ReaderList_UpdateAndGetCount() method. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceHandle the handle that will be assigned for interacting with the specified reader on success. + * @param reader_type Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_name Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_interface Refer to ReaderOpenEx() for detailed description of this parameter. arg Refer to ReaderOpenEx() for detailed description of this parameter. + * @param arg Refer to ReaderOpenEx() for detailed description of this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Add(UFR_HANDLE *DeviceHandle, uint32_t reader_type, + c_string port_name, uint32_t port_interface, void *arg); + + /** + * @brief Tries to re-open the device based on the serial number of the device. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param hndUFR handle of the uFR device + * @param Device_SN Serial number of the device contained as char array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenBySerial(VAR UFR_HANDLE *hndUFR, const char Device_SN[16]); + + // XXX: Obsolete functions - remain for backward compatibility + /** + * @brief + * Gets reader’s reader serial number as a pointer to 4 byte value, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulSerialNumber Contains reader serial number as a 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialByIndex(int32_t DeviceIndex, VAR uint32_t *lpulSerialNumber); + + /** + * @brief Gets reader’s descriptive name as a array of 8 chars, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param pSerialDescription Contains reader serial number as array of 8 chars + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialDescriptionByIndex(int32_t DeviceIndex, OUT uint8_t pSerialDescription[8]); + + /** + * @brief Gets devices reader type based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulReaderType Contains reader type as 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetTypeByIndex(int32_t DeviceIndex, VAR uint32_t *lpulReaderType); + + /** + * @brief Gets devices FTDI serial port number based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Serial Contains FTDI serial number as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDISerialByIndex(int32_t DeviceIndex, OUT char **Device_Serial); + + /** + * @brief Gets devices FTDI description based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Description FTDI description as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDIDescriptionByIndex(int32_t DeviceIndex, OUT char **Device_Description); + + /** + * @brief Tries to re-open the device based on the device index. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenByIndex(const int32_t DeviceIndex, VAR UFR_HANDLE *hndUFR); + + //-------------------------------------------------------------------------------------------------- + + // open first/next Reader and return handle - better to use ReaderList_OpenByIndex() + /** + * @brief Multi reader support. Open reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s, or if you have only one reader attached to another power supply (not your PC) it will open that reader based on it’s working mode (TCP or UDP). If you have more than one µFR Online device, ReaderOpen function will open the first one found, for opening another device, use ReaderOpenEx instead. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenM(VAR UFR_HANDLE *hndUFR); + +#ifdef ESP_PLATFORM + /** + * @brief @param hndUFR handle of the uFR device + * @param port_num + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderOpenM(VAR UFR_HANDLE *hndUFR, uint32_t port_num); +#endif + + /** + * @brief Multi reader support. Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderCloseM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTypeM(UFR_HANDLE hndUFR, OUT uint32_t *lpulReaderType); + + /** + * @brief Multi reader support. Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumberM(UFR_HANDLE hndUFR, OUT uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnectedM(UFR_HANDLE hndUFR, VAR uint32_t *connected); + + /** + * @brief Multi reader support. Store a new key or change existing key under provided index parameter.The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Multi reader support. Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. This function turns sound and light reader signals. Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignalM(UFR_HANDLE hndUFR, uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Multi reader support. From version 5.0.68. + * Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolumeM(UFR_HANDLE hndUFR, uint8_t sound_volume); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExtM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExtM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @param hndUFR handle of the uFR device + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * Multi reader support. From library version 5.0.36 and firmware version 5.0.37 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSakM(UFR_HANDLE hndUFR, uint16_t *atqa, uint8_t *sak); + + /** + * @brief Multi reader support. Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authenticationwith key A or key B:use KeyA - MIFARE_AUTHENT1A = 0x60or KeyB - MIFARE_AUTHENT1B = 0x61For NTAG 21x, Ultralight EV1 and other T2T tags supportingPWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead()or LinearRead_PK() functions. Value 0x60 with LinearRead() orLinearRead_PK() functions means “without PWD_AUTH“ and in thatcase you can send for ucReaderKeyIndex or aucProvidedKeyparameters anything you want without influence on the result. ForNTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTHyou can use _AKM1 or _AKM2 function variants only withoutPWD_AUTH in any case of the valid values (0x60 or 0x61) providedfor this parameter.For Mifare Plus tags (PK mode) defines whether to performauthentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCardM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKeyM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafeM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode)For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters + + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using absolute Block address. + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PKM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * Multi reader support. + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Multi reader support. Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + // New commands (for RTC & I2C EEPROM): + /** + * @brief Multi reader support. Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTimeM(UFR_HANDLE hndUFR, VAR uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into the device's RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password time + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTimeM(UFR_HANDLE hndUFR, IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Multi reader support. This function is used in Common, Advance and Access Control set of functions. + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPasswordM(UFR_HANDLE hndUFR, IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM. Maximal length of array is 128 bytes. Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWriteM(UFR_HANDLE hndUFR, IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescriptionM(UFR_HANDLE hndUFR, OUT uint8_t pSerialDescription[8]); + + // New since version 2.0: + /** + * @brief Multi reader support. Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumberM(UFR_HANDLE hndUFR, VAR uint8_t *build); + + /** + * @brief Multi reader support. This function returns UID of card actually present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief Multi reader support. This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi card mode: + //------------------------------------------------------------------------------ + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCardsM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + + /** + * @brief Multi reader support. Before calling this function you have to call EnumCards() first. + * For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCardsM(UFR_HANDLE hndUFR, OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + + /** + * @brief Multi reader support. Selects one of the cards which UID is on the actual UID list of the enumerated cards. If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCardM(UFR_HANDLE hndUFR, IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief Multi reader support. If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCardM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatusM(UFR_HANDLE hndUFR, VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns card type according to DlogicCardType enumeration. For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardTypeM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType); + + /** + * @brief Multi reader support. + * This function returns card manufacturer as char* buffer (c-style string). + * + * For details, please refer to the ISO/IEC JTC1/SC17 STANDING DOCUMENT 5 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param card_manufacturer_str manufacturer name as c_string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardManufacturerM(UFR_HANDLE hndUFR, OUT char *card_manufacturer_str); + + + /** + * @brief Multi reader support. This function returns 8 bytes of the T2T version. All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersionM(UFR_HANDLE hndUFR, OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Multi reader support. Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpulLinearSize pointer to variable which contain size of user data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSizeM(UFR_HANDLE hndUFR, VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * Multi reader support. From library version 5.0.59 and firmware version 5.0.60 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatusM(UFR_HANDLE hndUFR, OUT uint8_t *tt_message, VAR uint8_t *tt_status); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @param hndUFR handle of the uFR device + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @ingroup Card_Tag_M + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalDataM(UFR_HANDLE hndUFR, uint8_t data[32], uint32_t *len); + + /** + * @brief Multi reader support. Function returns reader’s serialized discovery loop structure i.e. C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetupM(UFR_HANDLE hndUFR, uint8_t *setupStruct, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoopM(UFR_HANDLE hndUFR, const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Multi reader support. Function returns the AID set in the reader to retrieve the mobile phone's unique ID. If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAidM(UFR_HANDLE hndUFR, uint8_t *aid, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAidM(UFR_HANDLE hndUFR, const uint8_t *aid, uint32_t len); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfigM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtpM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlotM(UFR_HANDLE hndUFR, uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKeyM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencryptedM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZoneM(UFR_HANDLE hndUFR, uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZoneM(UFR_HANDLE hndUFR, uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatusM(UFR_HANDLE hndUFR, VAR uint8_t *bool_config_zone_locked, + VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevisionM(UFR_HANDLE hndUFR, uint8_t revision[4]); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProModeM(UFR_HANDLE hndUFR, VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProModeM(UFR_HANDLE hndUFR, const uint32_t ReaderProMode); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_InitializeM(UFR_HANDLE hndUFR, IN const uint8_t *TBSerialString, uint16_t job_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCardM(UFR_HANDLE hndUFR, const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextM(UFR_HANDLE hndUFR, const uint32_t code_type, const uint32_t from_timestamp, + const uint32_t to_timestamp, const uint32_t additional_data_size, + IN const uint8_t additional_data[], VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSNM(UFR_HANDLE hndUFR, OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSNM(UFR_HANDLE hndUFR, VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSNM(UFR_HANDLE hndUFR, OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Multi reader support. Function returns TNF, type of record, ID and payload from the NDEF record. NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Multi reader support. Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, uint8_t *type_length, + IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, uint32_t *payload_length, + VAR uint8_t *card_formated); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroringM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_ttM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_countM(UFR_HANDLE hndUFR, VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, + OUT uint8_t *ndef_record_array, VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Multi reader support. Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_recordsM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initializationM(UFR_HANDLE hndUFR); + + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + + /** + * @brief Multi reader support. Function stores a message record for NTAG emulation mode into the reader. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefM(UFR_HANDLE hndUFR, uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, + uint8_t id_length, IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief Multi reader support. Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function returns current ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParamsM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. This command set ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParamsM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param is_field_present contains 0 if external field isn’t present or 1 if field is present. + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldStateM(UFR_HANDLE hndUFR, VAR uint8_t *is_field_present); + + /** + * @brief Multi reader support. Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. From library version 5.0.31, and firmware version 5.0.33 + * Function stores a message record for NTAG emulation mode into the reader in the RAM. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRamM(UFR_HANDLE hndUFR, uint8_t tnf, uint8_t *type_record, uint8_t type_length, + uint8_t *id, uint8_t id_length, uint8_t *payload, uint32_t payload_length); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking_M + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureM(UFR_HANDLE hndUFR, IN uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], + VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExtM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief Multi reader support. This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, uint32_t inc_value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successfulfunction execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterM(UFR_HANDLE hndUFR, VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RKM(UFR_HANDLE hndUFR, VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PKM(UFR_HANDLE hndUFR, VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Multi reader support. Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode sets idle mode value + * @param card_detection_mode sets card detection mode value + * @param idle_color sets idle color + * @param card_detection_color sets card detection color + * @param enabled value that enables it (1) or disables it (0) + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode returns idle mode value + * @param card_detection_mode returns card detection mode value + * @param idle_color returns idle color + * @param card_detection_color returns card detection color + * @param enabled returns 1 if enabled, 0 if disabled + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_numberM(UFR_HANDLE hndUFR, VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, VAR uint8_t *start_minute, + VAR uint8_t *end_hour, VAR uint8_t *end_minute, OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_recordM(UFR_HANDLE hndUFR, uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, + uint8_t begin_hour, uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, + uint8_t end_hour, uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_recordM(UFR_HANDLE hndUFR, VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, + VAR uint8_t *end_month, VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_typeM(UFR_HANDLE hndUFR, uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_typeM(UFR_HANDLE hndUFR, VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_durationM(UFR_HANDLE hndUFR, uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_durationM(UFR_HANDLE hndUFR, VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_durationM(UFR_HANDLE hndUFR, uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_durationM(UFR_HANDLE hndUFR, VAR uint32_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validityM(UFR_HANDLE hndUFR, VAR int32_t *credit, VAR uint32_t *begin_year, + VAR uint32_t *begin_month, VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, VAR uint32_t *end_year, VAR uint32_t *end_month, + VAR uint32_t *end_day, VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validityM(UFR_HANDLE hndUFR, int32_t credit, uint32_t begin_year, uint32_t begin_month, + uint32_t begin_day, uint32_t begin_hour, uint32_t begin_minute, uint32_t end_year, + uint32_t end_month, uint32_t end_day, uint32_t end_hour, uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint8_t *right_record_type, + OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counterM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, + uint16_t last_reader_nr, uint8_t start_hour, uint8_t start_minute, + uint8_t end_hour, uint8_t end_minute, IN uint8_t *days, + uint8_t max_daily_counter); + + //============================================================================= + + /** + * @brief Multi reader support. Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOnM(UFR_HANDLE hndUFR, uint16_t pulse_duration); + + /** + * @brief Multi reader support. Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayStateM(UFR_HANDLE hndUFR, uint8_t state); + + /** + * @brief Multi reader support. Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param intercom shows that there is voltage at the terminals for intercom connection, or not + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoStateM(UFR_HANDLE hndUFR, VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief + * Multi reader support. Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControlM(UFR_HANDLE hndUFR, uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Multi reader support. This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControlM(UFR_HANDLE hndUFR, uint8_t light_status); + + /** + * @brief Multi reader support. For classic uFR PLUS devices only. + * The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.55. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControlM(UFR_HANDLE hndUFR, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.64. + * The function sets color on the RGB diodes. This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleepM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.66. + * The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. Function also sets the number of omitted activity periods, when the RGB light is off. For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriodM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSetM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, uint8_t bad_select_nr_max); + + /** + * @brief Multi reader support. The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, VAR uint8_t *bad_select_nr_max); + + /** + * @brief Multi reader support. Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSetM(UFR_HANDLE hndUFR, uint8_t seconds_wait); + + /** + * @brief Multi reader support. Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGetM(UFR_HANDLE hndUFR, VAR uint8_t *seconds_wait); + + /** + * @brief Multi reader support. This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanentlyM(UFR_HANDLE hndUFR, unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Multi reader support. Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParametersM(UFR_HANDLE hndUFR, VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Multi reader support. Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayDataM(UFR_HANDLE hndUFR, IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Multi reader support. From version 5.0.55 + * Function has the same functionality as the function SetDisplayData. New feature is the RGB port selection. Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief Multi reader support. This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequencyM(UFR_HANDLE hndUFR, uint16_t frequency); + + /** + * @brief Multi reader support. SetRgbIntensity (alias from version 5.0.55) + * Function sets the intensity of light on the display. Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensityM(UFR_HANDLE hndUFR, uint8_t intensity); + + /** + * @brief Multi reader support. GetRgbIntensity (alias from version 5.0.55) + * Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensityM(UFR_HANDLE hndUFR, VAR uint8_t *intensity); + + // ############################################################################# + // ############################################################################# + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_ModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATSM(OUT UFR_HANDLE hndUFR, uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorageM(UFR_HANDLE hndUFR); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceiveM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint32_t *ufr_status); + /** + * @brief Multi reader support. + * Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_TransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, + uint8_t data_out_len, OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, + uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * Sends C–APDU in the c_string (zero terminated) format, containing pairs of the + hexadecimal digits. Pairs of the hexadecimal digits can be delimited by any of the punctuation + characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu C_APDU as string + * @param r_apdu R_APDU returned as string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceiveM(UFR_HANDLE hndUFR, IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief Multi reader support. + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are + sent and receive in the form of the byte arrays. There is obvious need for a c_apdu_len and + *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, + respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, + VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief Multi reader support. + * This is “exploded binary” alternative function intended for support APDU commands in ISO 14443- + 4A tags. APDUTransceive() receives separated parameters which are an integral part of the C– + APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls lcs + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, + uint32_t Nc, OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chainM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceiveM(UFR_HANDLE hndUFR, uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselectM(UFR_HANDLE hndUFR, uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceiveM(UFR_HANDLE hndUFR, uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, + uint8_t crypto1, uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Multi reader support. Function sets the parameters for transceive mode. If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_startM(UFR_HANDLE hndUFR, uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief Multi reader support. + * The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enableM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceiveM(UFR_HANDLE hndUFR, IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, + uint32_t bytes_to_receive, VAR uint32_t *rcv_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interfaceM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_GenericM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDUM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4M(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Using this function you can select the appropriate application on the card. For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAidM(UFR_HANDLE hndUFR, IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief Multi reader support. In JCApp cards you can put two types of asymmetric crypto keys. Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + const IN uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_type key_type + * @param key_index key_index + * @param key_designator key_designator + * @param key_bit_len key_bit_len + * @param params params + * @param params_size params_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPairM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, uint8_t key_designator, + uint16_t key_bit_len, IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBeginM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *chunk, uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdateM(UFR_HANDLE hndUFR, IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Multi reader support. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEndM(UFR_HANDLE hndUFR, VAR uint16_t *sig_len); + + /** + * @brief Multi reader support. + * This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignatureM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *plain_data, uint16_t plain_data_len, VAR uint16_t *sig_len, + IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, + uint8_t id_size); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Multi reader support. + * Using this function you can delete certificate objects from a card. This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCertM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index); + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjIdM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + + /** + * @brief Multi reader support. + * This function is used to login to the JCApp with an appropriate PIN code. Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLoginM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief Multi reader support. This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemainingM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief Multi reader support. This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChangeM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief Multi reader support. + * This function is used to unblock PIN code which is specified by the SO parameter. + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblockM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, + OUT uint8_t *exponent, VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *keyW, VAR uint16_t *keyWSize, OUT uint8_t *field, + VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, + VAR uint16_t *g_size, OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, + VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); // when keyW == NULL, returns size + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBitsM(UFR_HANDLE hndUFR, uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list_size Pointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSizeM(UFR_HANDLE hndUFR, VAR uint32_t *list_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFilesM(UFR_HANDLE hndUFR, OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief Multi reader support. + * This function returns file size indexed by the parameter card_file_index, on successful execution. Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file which size we want to get + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSizeM(UFR_HANDLE hndUFR, uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated d Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief Multi reader support. + * This function reads a file from the DLStorage card directly to the new file on the host file-system. If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. Parameter data_size defines the amount of data to be written in the file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief Multi reader support. + * This function writes file content from the host file-system to the new file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * After successful call to this function, the file on the DLStorage card will be deleted. Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFileM(UFR_HANDLE hndUFR, uint8_t file_index); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBacM(UFR_HANDLE hndUFR, IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], + OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * Use this function to read files from the eMRTD NFC tag. You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param file_index file index + * @param output buffer that storese output + * @param output_length length of the returned output + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt send_sequence_cnt + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *file_index, VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Extracts Document Signing (DS) certificate in ASN.1 DER format from SOD. + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param[in] hndUFR The handle to the uFR reader. + * @param[out] cert A pointer to a uint8_t pointer. This will point to the allocated memory containing the + * certificate (ASN.1 DER format). The user is responsible for freeing this memory using DLFree() + * after use. + * @param[out] certlen A pointer to a uint32_t that will store the length of the certificate. + * @param[in] ksenc A uint8_t array of size 16 containing the encryption key. + * @param[in] ksmac A uint8_t array of size 16 containing the MAC key. + * @param[in,out] send_sequence_cnt A pointer to a uint64_t that keeps track of the send sequence counter. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SOD_CertToHeapM(UFR_HANDLE hndUFR, VAR uint8_t **cert, VAR uint32_t *certlen, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * This function validates data groups read from the eMRTDocument. All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * ________________ + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidateM(UFR_HANDLE hndUFR, IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, + uint32_t verbose_level, OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + // ############################################################################# + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Start(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StartM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Stop(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StopM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Start(void); // Alias for uFR_DESFIRE_Start() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StartM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StartM() + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Stop(void); // Alias for uFR_DESFIRE_Stop() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StopM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StopM() + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUidM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3desM(UFR_HANDLE hndUFR, IN uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Provided Key mode (PK) + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function returns the available bytes on the card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param free_mem_byte pointer to free memory size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFreeMemM(UFR_HANDLE hndUFR, VAR uint32_t *free_mem_byte, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCardM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * Provided Key mode (PK) + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + /** + * @brief Multi reader support. Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Provided Key mode (PK) + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key provided key + * Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * No authentication + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + // 121212 + /** + * @brief Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. + * + * If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * Multi reader support + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationd2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfigurationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. Provided Key mode (PK) + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. No authentication + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Function allows to set card master key, and application master key configuration settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr ordinal number of AES key in the reader + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_2k3des_key_nr, uint8_t aid_key_no, uint8_t old_2k3des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_2k3des_key_nr, uint8_t aid_key_no, + uint8_t old_2k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key_nr ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_des3k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_3k3des_key_nr, uint8_t aid_key_no, + uint8_t old_3k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of the key stored in the reader + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. 128 bit AES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_des_key[8], uint8_t aid_key_no, IN uint8_t old_des_key[8], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_des_key[8], uint8_t aid_key_no, + IN uint8_t old_des_key[8], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key pointer to 32 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key 24 bytes array that represent 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key 24 bytes array that represent current 3K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des3k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_3k3des_key[24], uint8_t aid_key_no, + IN uint8_t old_3k3des_key[24], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key pointer to array contained new AES key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t auth_key_type, IN uint8_t *new_key, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr key index of AES key stored in the reader that will be new AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr key index of AES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeAesKey_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des3k_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_des3k_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange3k3desKey_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des3k_key_nr, uint8_t aid_key_no, uint8_t old_des3k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows you to change any AES key on the card. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. *only uFR CS with SAM support + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of a key stored in the reader that will be new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief + * Function writes AES key (16 bytes) into reader. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key in the reader (0 - 15) + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_no, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Function writes AES key (16 bytes) into reader. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param key_no ordinal number of key in the reader (0 - 15) + * @param key pointer to array containing the key + * @param key_type enumerated key type (0 - 3) + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteKeyM(UFR_HANDLE hndUFR, uint8_t key_no, IN uint8_t *key, uint8_t key_type); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIdsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_no_auth_M(UFR_HANDLE hndUFR, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t number_of_records, uint16_t record_size, uint8_t communication_settings, + uint8_t *data, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + uint8_t *data, + uint16_t *card_status, + uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuth_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileDesAuth_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile2k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. Provided Key mode (PK) + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multireader support. 128 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no ey for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsSdmAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows changing of file settings + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * *only uFR CS with SAM support + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetTransactionTimerAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). . + * + * Multi reader support. + * From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param card_uid 7 bytes length card UID + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireUidReadECCSignatureM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, OUT uint8_t *card_uid, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aesM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOnM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function prohibits the blinking of the green diode independently of the user's signaling command. LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOffM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOnM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOffM(UFR_HANDLE hndUFR); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t CWGsNOff, uint8_t ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API FastFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersM(UFR_HANDLE hndUFR, uint8_t *mui, uint8_t *serial_nr, uint8_t *hw_type, uint8_t *hw_ver, + uint8_t *device_type, uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrateM(UFR_HANDLE hndUFR, OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersPN7462_M(UFR_HANDLE hndUFR, uint8_t *die_id, uint8_t *serial_nr, + + uint8_t *hw_type, uint8_t *hw_ver, uint8_t *device_type, + uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + // SAM + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_rawM(UFR_HANDLE hndUFR, OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_versionM(UFR_HANDLE hndUFR, VAR SAM_HW_TYPE *sam_type, VAR uint8_t *sam_uid); + + /** + * @brief Multi reader support. Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_rawM(UFR_HANDLE hndUFR, uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_v ADD DESCRIPTION + * @param des_key ADD DESCRIPTION + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_desM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_keyM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param master_aes_key ADD DESCRIPTION + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_modeM(UFR_HANDLE hndUFR, IN uint8_t *master_aes_key, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plainM(UFR_HANDLE hndUFR, IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *keyA, + IN uint8_t *keyB, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_ULC_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_desfire_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, + uint8_t ver_a, IN uint8_t *aes_key_ver_b, uint8_t ver_b, + IN uint8_t *aes_key_ver_c, uint8_t ver_c, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, uint8_t sam_lock_unlock, + uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKeyM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * Multi reader support. + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeableM(UFR_HANDLE hndUFR); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * Multi reader support. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfResetM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOnM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch off RF field at the reader. + * + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOffM(UFR_HANDLE hndUFR); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderIdM(UFR_HANDLE hndUFR, uint8_t *reader_id); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePersoM(UFR_HANDLE hndUFR, uint16_t address, IN uint8_t *data); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPersoM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param card_master_key pointer to 16 byte array containing the card master key + * @param card_config_key pointer to 16 byte array containing the card configuration key + * @param level_2_switch_key pointer to 16 byte array containing the key for switch to security level 2 + * @param level_3_switch_key pointer to 16 byte array containing the key for switch to security level 3 + * @param level_1_auth_key pointer to 16 byte array containing the key for optional authentication at security level 1 + * @param select_vc_key pointer to 16 byte array containing the key for virtual card selection + * @param prox_chk_key pointer to 16 byte array containing the key for proximity check + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling + * @param vc_poll_mac_key pointer to 16 byte array containing the MAC key for virtual card polling + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimalM(UFR_HANDLE hndUFR, IN uint8_t *card_master_key, IN uint8_t *card_config_key, + IN uint8_t *level_2_switch_key, IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, + IN uint8_t *select_vc_key, IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, + IN uint8_t *vc_poll_mac_key); + + /** + * @brief Multi reader support. Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, + uint8_t prox_check_use); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ADordinary number of current sector key stored into reader that wile become new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKeyM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, + OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @param hndUFR handle of the uFR device + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PKM(UFR_HANDLE hndUFR, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief Multi reader support. Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PKM(UFR_HANDLE hndUFR, IN uint8_t *key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_authM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + + // ESP32 + /** + * @brief Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. + * + * Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayData(IN uint8_t *display_data, IN uint8_t data_length, uint16_t duration); + + /** + * @brief Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderReset(void); + + /** + * @brief It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM of uFR Online. + * + * Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param time pointer to the array containing current date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTime(OUT uint8_t *time); + + /** + * @brief Function sets the date and time into uFR Online RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOState(uint8_t pin, uint8_t state); + + /** + * @brief Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOState(OUT uint8_t *state); + + /** + * @brief Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReader(uint8_t reader); + + /** + * @brief Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param SerialNumber pointer to SerialNumber variable. “SerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumber(VAR uint32_t *SerialNumber); + + /** + * @brief Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersion(OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOff(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifi(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableWifi(void); + + // NDEF MESSAGES + //---------------------------------------------------------- + + enum NDEF_STORAGE_MODE + { + STORE_INTO_READER = 0, + STORE_INTO_CARD + }; + + enum NDEF_SKYPE_ACTION + { + CALL = 0, + CHAT + }; + + // WiFi NDEF authentication type + enum WIFI_AUTH_TYPE + { + OPEN = 0, + WPA_PERSONAL, + WPA_ENTERPRISE, + WPA2_ENTERPRISE, + WPA2_PERSONAL + }; + + // WiFi NDEF encryption type + enum WIFI_ENC_TYPE + { + NONE = 0, + WEP, + TKIP, + AES, + AES_TKIP + }; + + /** + * @brief + * Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFi(uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, uint8_t encryption_type, + IN const char *password); + + /** + * @brief Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters)(e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BT(uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMS(uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Bitcoin(uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocation(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestination(uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Email(uint8_t ndef_storage, IN const char *email_address, IN const char *subject, IN const char *message); + + /** + * @brief Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Address(uint8_t ndef_storage, IN const char *address); + + /** + * @brief Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidApp(uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Store text as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Text(uint8_t ndef_storage, IN const char *text); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetView(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Skype(uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Whatsapp(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Viber(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Contact(uint8_t ndef_storage, IN const char *name, IN const char *company, IN const char *address, + IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Phone(uint8_t ndef_storage, IN const char *phone_number); + + /** + * @brief Multi reader support. Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFiM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, + uint8_t encryption_type, IN const char *password); + + /** + * @brief Multi reader support. Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters) (e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BTM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Multi reader support. Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMSM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Multi reader support. Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BitcoinM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Multi reader support. Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_EmailM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *email_address, IN const char *subject, + IN const char *message); + + /** + * @brief Multi reader support. Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AddressM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *address); + + /** + * @brief Multi reader support. Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Multi reader support. Store text as NDEF message into reader or into card. + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_TextM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *text); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetViewM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SkypeM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Multi reader support. Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WhatsappM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ViberM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ContactM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *name, IN const char *company, + IN const char *address, IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Multi reader support. Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_PhoneM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number); + //--------------------------------------------------------------------------------------------- + /** + * @brief Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF + * + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFi(OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, OUT char *password); + + /** + * @brief Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Bitcoin(OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocation(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF + * + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestination(OUT char *destination); + + /** + * @brief Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Email(OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF + * + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Address(OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF + * + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidApp(OUT char *package_name); + + /** + * @brief Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF + * + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Text(OUT char *text); + + /** + * @brief Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetView(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF + * + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Skype(OUT char *user_name, OUT char *action); + + /** + * @brief Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Whatsapp(OUT char *message); + + /** + * @brief Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Viber(OUT char *message); + + /** + * @brief Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF + * + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Contact(OUT char *vCard); + + /** + * @brief Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Phone(OUT char *phone_number); + + /** + * @brief Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMS(OUT char *phone_number, OUT char *message); + + /** + * @brief Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BT(OUT char *bt_mac_address); + + /** + * @brief Multi reader support. Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFiM(UFR_HANDLE hndUFR, OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, + OUT char *password); + + /** + * @brief Multi reader support. Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BitcoinM(UFR_HANDLE hndUFR, OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, OUT char *destination); + + /** + * @brief Multi reader support. Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_EmailM(UFR_HANDLE hndUFR, OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AddressM(UFR_HANDLE hndUFR, OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, OUT char *package_name); + + /** + * @brief Multi reader support. Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_TextM(UFR_HANDLE hndUFR, OUT char *text); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetViewM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SkypeM(UFR_HANDLE hndUFR, OUT char *user_name, OUT char *action); + + /** + * @brief Multi reader support. Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WhatsappM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ViberM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ContactM(UFR_HANDLE hndUFR, OUT char *vCard); + + /** + * @brief Multi reader support. Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_PhoneM(UFR_HANDLE hndUFR, OUT char *phone_number); + + /** + * @brief Multi reader support. Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMSM(UFR_HANDLE hndUFR, OUT char *phone_number, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BTM(UFR_HANDLE hndUFR, OUT char *bt_mac_address); + + /** + * @brief Used to parse NDEF record into separate parameters + * + * @ingroup Card_Tag_NDEF + * + * @param type_record pointer to the array containing record type + * @param type_len length of the record type + * @param payload pointer to the array containing record payload + * @param payload_len length of the record payload + * + * @return Operation status + */ + c_string DL_API ParseNdefMessage(IN uint8_t *type_record, uint8_t type_len, IN uint8_t *payload, uint32_t payload_len); + + // NT4H + + /** + * @brief Multi reader support. Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parametersM(UFR_HANDLE hndUFR, uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function returns file settings. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext); + + /** + * @brief Multi reader support. Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_ridM(UFR_HANDLE hndUFR, uint8_t aes_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uidM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_keyM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctrM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. No authentication + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_authM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signatureM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_statusM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_authM(UFR_HANDLE hndUFR, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_ttM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_fileM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief Multi reader support. Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint16_t duration); + + /** + * @brief Multi reader support. Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPasswordM(UFR_HANDLE hndUFR, uint8_t *old_password, uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM of uFR Online. Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWriteM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size, uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromReadM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into uFR Online RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *password, uint8_t *time); + + /** + * @brief Multi reader support. Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOStateM(UFR_HANDLE hndUFR, uint8_t pin, uint8_t state); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOStateM(UFR_HANDLE hndUFR, uint8_t *state); + + /** + * @brief Multi reader support. Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReaderM(UFR_HANDLE hndUFR, uint8_t reader); + + /** + * @brief Multi reader support. Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumberM(UFR_HANDLE hndUFR, uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersionM(UFR_HANDLE hndUFR, OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Multi reader support. Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOffM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableOnWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Function sets service data into eeprom. Only use with production firmware. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param hndUFR handle of the uFR device + * @param data pointer to array of 5 bytes which contains new service data + * @return Operation status + */ + UFR_STATUS DL_API SetServiceDataM(UFR_HANDLE hndUFR, IN uint8_t *data); + + /** + * @brief Function gets service data from eeprom. Use in diagnostic tool. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param hndUFR handle of the uFR device + * @param data pointer to array which contains service data + * @return Operation status + */ + UFR_STATUS DL_API GetServiceDataM(UFR_HANDLE hndUFR, OUT uint8_t *data); + + /** + * @brief Function gets number and types of the installed I2C devices at the reader + * @since uFCoder library version 6.0.18 + * + * @ingroup INTERNAL + * @param dev_num number of I2C devices found + * @param dev_bits bit array that represents types of I2C devices + * @return Operation status + */ + UFR_STATUS DL_API GetI2cDevicesStatusM(UFR_HANDLE hndUFR, uint8_t *dev_num, uint32_t *dev_bits); + + /** + * @brief Function gets lock status of the reader + * @since uFCoder library version 6.0.19 + * + * @ingroup INTERNAL + * @param lock_status + * @return Operation status + */ + UFR_STATUS DL_API GetReaderLockStatusM(UFR_HANDLE hndUFR, uint8_t *lock_status); + + /** + * @brief Function changes password at the NXP ICODE cards (provided passwords) + * @since uFCoder library version 6.0.13 + * + * @ingrup + * @param pwd_ident - Password Identifier + * @param current_password - pointer to the 4 bytes array that represents current password + * @param new_password - pointer to the 4 bytes array that represents new password + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password_PK_M(UFR_HANDLE hndUFR, uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); + + /** + * @brief Function changes password at the NXP ICODE cards (reader's passwords) + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param pwd_ident - Password Identifier + * @param current_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @param new_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @return Operation status + */ + UFR_STATUS DL_API icode_write_passwordM(UFR_HANDLE hndUFR, uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page_PK_M(UFR_HANDLE hndUFR, IN uint8_t *read_password, IN uint8_t *write_password, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_pageM(UFR_HANDLE hndUFR, uint8_t read_pass_index, uint8_t write_pass_index, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function locks permanently the requested block on the ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API iso15693_lock_block_no_authM(UFR_HANDLE hndUFR, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block_PK_M(UFR_HANDLE hndUFR, IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_blockM(UFR_HANDLE hndUFR, uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); + + /** + * @brief Function read the security status of the blocks from ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param first_block - address of the first block for security status reading + * @param number_of_blocks - number of blocks for security status reading + * @param block_data - pointer to the array of blocks security status (1 - block locked, 0 - block not locked). + * @return Operation status + */ + UFR_STATUS DL_API iso15693_get_multiply_block_security_statusM(UFR_HANDLE hndUFR, uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + + + /** + * @brief Multi reader support. As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + + + UFR_STATUS DL_API COMTransceiveM(UFR_HANDLE hndUFR, IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General + * + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + UFR_STATUS DL_API COMTransceive(IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + // DLL version ---------------------------------------------------------------- + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + uint32_t DL_API GetDllVersion(void); + + /* + * Get "exploded" dll version example: + * + * #include + * #include + * + * void main(int argc, char *argv[]) + * { + * uint32_t dwDllVersion = 0; + * uint32_t dwDllMajorVersion = 0; + * uint32_t dwDllMinorVersion = 0; + * uint32_t dwDllBuild = 0; + * + * dwDllVersion = GetDllVersion(); + * + * // "explode" the dll version: + * dwDllMajorVersion = (DWORD)(LOBYTE(LOWORD(dwDllVersion))); + * dwDllMinorVersion = (DWORD)(HIBYTE(LOWORD(dwDllVersion))); + * + * // Get the dll build number. + * dwDllBuild = (DWORD)(HIWORD(dwDllVersion)); + * + * printf("Dll version is %ld.%ld (%ld)\n", dwDllMajorVersion, + * dwDllMinorVersion, + * dwDllBuild); + * } + * + */ + // Originality Check (performs the check is the chip on the card/tag NXP genuine): + /** + * @brief This function depends on OpenSSL crypto library. Since OpenSSL crypto library is dynamically linked during execution, the only prerequisite for a successful call to this function is that the libeay32.dll is in the current folder (valid for Windows) and / or libcrypto.so is in the environment path (e.g. LD_LIBRARY_PATH on Linux / macOS). OriginalityCheck() performs the check if the chip on the card / tag is NXP genuine. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param signature ECCSignature acquired by call to the ReadECCSignature() function. + * @param uid Card UID. Best if the card UID is acquired by previous call to the ReadECCSignature() function. + * @param uid_len Card UID length. Best if the card UID length is acquired by previous call to the ReadECCSignature() function. + * @param DlogicCardType Card type. Best if the DlogicCardType is acquired by previous call to the ReadECCSignature() function. + * + * @return Operation status + */ + UFR_STATUS DL_API OriginalityCheck(IN const uint8_t *signature, IN const uint8_t *uid, uint8_t uid_len, uint8_t DlogicCardType); + // Returns: + // UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND in case there is no OpenSSL library (libeay32.dll) in current folder or path + // UFR_OPEN_SSL_DYNAMIC_LIB_FAILED in case of OpenSSL library error (e.g. wrong OpenSSL version) + // UFR_NOT_NXP_GENUINE if chip on the card/tag is NOT NXP genuine + // UFR_OK is chip on the card/tag is NXP GENUINE + + //// debug functions: + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + c_string DL_API GetDllVersionStr(void); + + /** + * @brief Returns UFR_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param status UFR_STATUS status variable + * + * @return Operation status + */ + c_string DL_API UFR_Status2String(const UFR_STATUS status); + + /** + * @brief Returns UFR_SESSION_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param session_status UFR_SESSION_STATUS status variable + * + * @return c_string value of the status code + */ + c_string DL_API UFR_SessionStatus2String(const UFR_SESSION_STATUS session_status); + + /** + * @brief Returns card type as a c_string instead of byte value + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param dl_type_code card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + c_string DL_API UFR_DLCardType2String(uint8_t dl_type_code); + +//// Helper functions: +#ifndef _WIN32 + + unsigned long GetTickCount(void); + +#endif // #ifndef _WIN32 + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information + * + * @return The reader's descriptive name + */ + c_string DL_API GetReaderDescription(void); + + /** + * @brief Multi reader support. This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * + * @return Returns the reader's descriptive name. + */ + c_string DL_API GetReaderDescriptionM(UFR_HANDLE hndUFR); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// #ifdef _WIN32 || __linux__ + +// #else +// #endif // _WIN32 + + + +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#ifdef __ANDROID__ +#include + + extern JNIEnv *global_env; + extern jclass global_class; + extern jclass usb_global_class; + + /** + + * + * @param env + * @param class1 + * + * @return Operation status + */ + void DL_API initVM(JNIEnv *env, jclass class1); +#endif + + + +#ifdef __APPLE__ +#include +#if TARGET_OS_IPHONE + typedef void (*CardDetectedCallback)(void *_Nonnull context, const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(void *_Nonnull context); + typedef void (*SessionErrorCallback)(void *_Nonnull context, UFR_SESSION_STATUS error_code, const char *error_description); + /** + * @brief For iOS only: This function is used to set message displayed when the NFC Session window is started
+ * E.g 'Read the tag with the phone' + * NFC Session can be started via ReaderOpenEx() and appropriate parameters, or openNFCSession() + * @since uFCoder library version 6.0.0 + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + void setNFCMessage(const char *message); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * @param context pointer to UIView that bridges Swift with native code. e.g `let ble_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(void *_Nonnull context, const char *reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + void DL_API closeBLESession(void); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param context pointer to UIView that bridges Swift with native code. e.g `let nfc_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(void *_Nonnull context, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char *license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); +#else + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); + +#endif // TARGET_OS_IPHONE +#endif // __APPLE__ + +#ifdef __ANDROID__ + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param reader_sn uFR Online reader serial number (e.g ONXXXXXX) + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param session_error_callback TEST + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(const char *reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openBLESession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeBLESession(void); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char *license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); +#endif // __ANDROID__ + +#if defined(_WIN32) || defined(__linux__) + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + /** + * @brief This function is used to enable asynchronous event-driven API callbacks.
+ * Prerequisites: ReaderOpen() or ReaderOpenEx() must be called first and must return `UFR_OK` status to open connection with the reader
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by StartAsyncSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + UFR_STATUS DL_API StopAsyncSession(); + +#endif // _WIN32 || __linux__ + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardDetectedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardDetectedCallback(CardDetectedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardRemovedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardRemovedCallback(CardRemovedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'SessionErrorCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setSessionErrorCallback(SessionErrorCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* uFCoder_H_ */ diff --git a/ufr-lib/ios/libuFCoder-ios-static.a b/ufr-lib/ios/libuFCoder-ios-static.a new file mode 100644 index 0000000..bd033b6 Binary files /dev/null and b/ufr-lib/ios/libuFCoder-ios-static.a differ diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/Info.plist b/ufr-lib/ios_framework/uFCoder.xcframework/Info.plist new file mode 100644 index 0000000..d3c5508 --- /dev/null +++ b/ufr-lib/ios_framework/uFCoder.xcframework/Info.plist @@ -0,0 +1,48 @@ + + + + + AvailableLibraries + + + BinaryPath + libuFCoder-ios_simulator-static.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + libuFCoder-ios_simulator-static.a + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + BinaryPath + libuFCoder-ios-static.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64 + LibraryPath + libuFCoder-ios-static.a + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/Headers/module.modulemap b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/Headers/module.modulemap new file mode 100644 index 0000000..ff3803f --- /dev/null +++ b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/Headers/module.modulemap @@ -0,0 +1,5 @@ +module uFCoder { + header "uFCoder.h" + + export * +} diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/Headers/uFCoder.h b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/Headers/uFCoder.h new file mode 100644 index 0000000..361b60f --- /dev/null +++ b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/Headers/uFCoder.h @@ -0,0 +1,49871 @@ +/* + * uFCoder.h + * + * library version: 6.0.21 + * + * Created on: 2009-01-14 + * Last edited: 2025-06-18 + * + * Author: D-Logic + */ +#ifndef uFCoder_H_ +#define uFCoder_H_ + +#include +#include +#include + +#define IN // array that you pass to function +#define OUT // array that you receive from function +#define VAR // first element of array that you receive from function (single variable) + +//////////////////////////////////////////////////////////////////// +/** + * Type for representing null terminated char array ( aka C-String ) + * Array is always one byte longer ( for null character ) then string + * Memory space for array must be allocated before use. + */ +typedef const char *c_string; +//////////////////////////////////////////////////////////////////// + +#ifdef _WIN32 +// WINDOWS +#if defined(DL_CREATE_STATIC_LIB) || defined(DL_USE_STATIC_LIB) +#define DL_API +#else +#ifndef DL_uFC_EXPORTS +#ifdef _WIN_IOT +#define DL_API __declspec(dllimport) // Win IoT +#else +#define DL_API /*__declspec(dllimport) */ __stdcall // STDCALL - GCC - .NET +#endif // _WIN_IOT +#else +#define DL_API __declspec(dllexport) __stdcall +#endif // DL_uFC_EXPORTS +#endif // DL_CREATE_STATIC_LIB +#else +// Linux & MAC OS +#define DL_API +#endif // _WIN32 + +#if defined(DL_uFC_EXPORTS) || defined(DL_CREATE_STATIC_LIB) || defined(__ANDROID__) || defined(ESP_PLATFORM) || defined(IOS_PLATFORM) +typedef struct S_UFR_HANDLE *UFR_HANDLE; +#else +typedef void *UFR_HANDLE; +#endif + +// MIFARE CLASSIC type id's: +#define MIFARE_CLASSIC_1k 0x08 +#define MF1ICS50 0x08 +#define SLE66R35 0x88 // Infineon = Mifare Classic 1k +#define MIFARE_CLASSIC_4k 0x18 +#define MF1ICS70 0x18 +#define MIFARE_CLASSIC_MINI 0x09 +#define MF1ICS20 0x09 + +// DLOGIC CARD TYPE +#define TAG_UNKNOWN 0 +#define DL_MIFARE_ULTRALIGHT 0x01 +#define DL_MIFARE_ULTRALIGHT_EV1_11 0x02 +#define DL_MIFARE_ULTRALIGHT_EV1_21 0x03 +#define DL_MIFARE_ULTRALIGHT_C 0x04 +#define DL_NTAG_203 0x05 +#define DL_NTAG_210 0x06 +#define DL_NTAG_212 0x07 +#define DL_NTAG_213 0x08 +#define DL_NTAG_215 0x09 +#define DL_NTAG_216 0x0A +#define DL_MIKRON_MIK640D 0x0B +#define NFC_T2T_GENERIC 0x0C +#define DL_NT3H_1101 0x0D +#define DL_NT3H_1201 0x0E +#define DL_NT3H_2111 0x0F +#define DL_NT3H_2211 0x10 +#define DL_NTAG_413_DNA 0x11 +#define DL_NTAG_424_DNA 0x12 +#define DL_NTAG_424_DNA_TT 0x13 +#define DL_NTAG_210U 0x14 +#define DL_NTAG_213_TT 0x15 + +#define DL_MIFARE_CLASSIC_2K 0x19 +#define DL_MIFARE_MINI 0x20 +#define DL_MIFARE_CLASSIC_1K 0x21 +#define DL_MIFARE_CLASSIC_4K 0x22 +#define DL_MIFARE_PLUS_S_2K_SL0 0x23 +#define DL_MIFARE_PLUS_S_4K_SL0 0x24 +#define DL_MIFARE_PLUS_X_2K_SL0 0x25 +#define DL_MIFARE_PLUS_X_4K_SL0 0x26 +#define DL_MIFARE_DESFIRE 0x27 +#define DL_MIFARE_DESFIRE_EV1_2K 0x28 +#define DL_MIFARE_DESFIRE_EV1_4K 0x29 +#define DL_MIFARE_DESFIRE_EV1_8K 0x2A +#define DL_MIFARE_DESFIRE_EV2_2K 0x2B +#define DL_MIFARE_DESFIRE_EV2_4K 0x2C +#define DL_MIFARE_DESFIRE_EV2_8K 0x2D +#define DL_MIFARE_PLUS_S_2K_SL1 0x2E +#define DL_MIFARE_PLUS_X_2K_SL1 0x2F +#define DL_MIFARE_PLUS_EV1_2K_SL1 0x30 +#define DL_MIFARE_PLUS_X_2K_SL2 0x31 +#define DL_MIFARE_PLUS_S_2K_SL3 0x32 +#define DL_MIFARE_PLUS_X_2K_SL3 0x33 +#define DL_MIFARE_PLUS_EV1_2K_SL3 0x34 +#define DL_MIFARE_PLUS_S_4K_SL1 0x35 +#define DL_MIFARE_PLUS_X_4K_SL1 0x36 +#define DL_MIFARE_PLUS_EV1_4K_SL1 0x37 +#define DL_MIFARE_PLUS_X_4K_SL2 0x38 +#define DL_MIFARE_PLUS_S_4K_SL3 0x39 +#define DL_MIFARE_PLUS_X_4K_SL3 0x3A +#define DL_MIFARE_PLUS_EV1_4K_SL3 0x3B +#define DL_MIFARE_PLUS_SE_SL0 0x3C +#define DL_MIFARE_PLUS_SE_SL1 0x3D +#define DL_MIFARE_PLUS_SE_SL3 0x3E +#define DL_MIFARE_DESFIRE_LIGHT 0x3F + +#define DL_UNKNOWN_ISO_14443_4 0x40 +#define DL_GENERIC_ISO14443_4 0x40 +#define DL_GENERIC_ISO14443_4_TYPE_B 0x41 +#define DL_GENERIC_ISO14443_3_TYPE_B 0x42 +#define DL_MIFARE_PLUS_EV1_2K_SL0 0x43 +#define DL_MIFARE_PLUS_EV1_4K_SL0 0x44 +#define DL_MIFARE_DESFIRE_EV3_2K 0x45 +#define DL_MIFARE_DESFIRE_EV3_4K 0x46 +#define DL_MIFARE_DESFIRE_EV3_8K 0x47 + +// ISO15693 cards +#define DL_GENERIC_ISO15693 0x50 +#define DL_ICODE_SLIX 0x51 +#define DL_ICODE_SLIX_S 0x52 +#define DL_ICODE_SLIX_L 0x53 +#define DL_ICODE_SLIX_2 0x54 +#define DL_ICODE_DNA 0x55 +#define DL_ICODE_3 0x56 + +#define DL_MOBILE_AID 0x60 +#define DL_APPLE_VAS_V1 0x6A +#define DL_APPLE_VAS_V2 0x6B +#define DL_IMEI_UID 0x80 + +// ST Product ID-s: +#define M24SR02 0x82 +#define M24SR02_AUTOMOTIVE 0x8A +#define M24SR04 0x86 +#define M24SR04_AUTOMOTIVE 0x8E +#define M24SR16 0x85 +#define M24SR16_AUTOMOTIVE 0x8D +#define M24SR64 0x84 +#define M24SR64_AUTOMOTIVE 0x8C + +// DLJavaCardTypes: +#define DLSigner81 0xA0 +#define DLSigner22 0xA1 +#define DLSigner30 0xA2 +#define DLSigner10 0xA3 +#define DLSigner145 0xAA + +enum E_CARD_IN_SAM_SLOT +{ + SAM_SLOT_MIFARE_SAM_AV2 = 1, + SAM_SLOT_GENERIC = 4 +}; + +// DLJavaCardSignerAlgorithmTypes: +enum E_SIGNER_CIPHERS +{ + SIG_CIPHER_RSA = 0, + SIG_CIPHER_ECDSA, + + SIG_CIPHER_MAX_SUPPORTED +}; + +enum E_SIGNER_RSA_PADDINGS +{ + PAD_NULL = 0, + PAD_PKCS1_V1_5, + PAD_PKCS1_PSS, + + SIG_PAD_MAX_SUPPORTED +}; +#define PAD_PKCS1 PAD_PKCS1_V1_5 + +enum E_SIGNER_DIGESTS +{ + ALG_NULL = 0, + ALG_SHA, + ALG_SHA_256, + ALG_SHA_384, + ALG_SHA_512, + ALG_SHA_224, + ALG_SHA_512_224, + ALG_SHA_512_256, + + SIG_DIGEST_MAX_SUPPORTED +}; + +enum E_KEY_TYPES +{ + TYPE_RSA_PRIVATE = 0, + TYPE_RSA_CRT_PRIVATE, + TYPE_EC_F2M_PRIVATE, + TYPE_EC_FP_PRIVATE +}; + +enum E_OBJ_TYPES +{ + OBJ_TYPE_RSA_CERT = 0, + OBJ_TYPE_EC_CERT, + OBJ_TYPE_CA_CERT, + + OBJ_TYPES_COUNT +}; + +// JCDL_AIDs +#define DL_RAW_SIZEOF_SZ(x) (sizeof(x) - 1) +#define DL_AID_RID_PLUS "\xF0" "DLogic" +#define DL_SIGNER_PIX "\x00\x01" +#define DL_STORAGE_PIX "\x01\x01" +#define DL_SIGNER_AID DL_AID_RID_PLUS DL_SIGNER_PIX +#define DL_SIGNER_AID_SIZE 9 +#define DL_STORAGE_AID DL_AID_RID_PLUS DL_STORAGE_PIX +#define DL_STORAGE_AID_SIZE 9 + +// Universal JCDL instructions: +#define INS_LOGIN 0x20 +#define INS_GET_PIN_TRIES_REMAINING 0x21 +#define INS_PIN_CHANGE 0x22 +#define INS_PIN_UNBLOCK 0x23 + +// JCDLStorage instructions: +#define INS_PIN_ENABLE 0x24 +#define INS_PIN_DISABLE 0x25 +#define INS_LIST_FILES 0x31 +#define INS_GET_FILE_SIZE 0x32 +#define INS_READ_FILE 0x33 +#define INS_WRITE_FILE 0x34 +#define INS_DELETE_FILE 0x3F + +// JCDLSigner instructions: +#define INS_SET_RSA_PRIKEY 0x51 +#define INS_GEN_RSA_KEY_PAIR 0x52 +#define INS_GET_RSA_PUBKEY_MODULUS 0x53 +#define INS_GET_RSA_PUBKEY_EXPONENT 0x54 +#define INS_DEL_RSA_KEY_PAIR 0x5F +#define INS_SET_EC_PRIKEY 0x61 +#define INS_GEN_EC_KEY_PAIR 0x62 +#define INS_GET_EC_PUBKEY 0x63 +#define INS_GET_EC_FIELD 0x64 +#define INS_GET_EC_AB 0x65 +#define INS_GET_EC_G 0x66 +#define INS_GET_EC_RK_SIZE 0x67 +#define INS_DEL_EC_KEY_PAIR 0x6F +#define INS_GET_SIGNATURE 0x71 +#define INS_PUT_OBJ 0x31 +#define INS_PUT_OBJ_SUBJECT 0x32 +#define INS_INVALIDATE_CERT 0x33 +#define INS_GET_OBJ 0x41 +#define INS_GET_OBJ_ID 0x42 +#define INS_GET_OBJ_SUBJECT 0x43 + +// Universal JCDL constants: +#define PIN_MAX_TRIES 5 +#define PIN_MIN_LENGTH 4 +#define PIN_MAX_LENGTH 8 +#define PUK_MAX_TRIES 10 +#define PUK_LENGTH 8 + +// JCDLSigner constants: +#define JC_APP_MAX_KEY_INDEX ((3) - 1) +#define JC_APP_MAX_CA_CERT_INDEX ((12) - 1) +#define JC_APP_MAX_ID_SIZE 253 +#define JC_APP_MAX_SUBJECT_SIZE 255 +#define JC_APP_MAX_SIGNATURE_LEN 256 +#define JC_APP_MAX_PIN_LENGTH 8 + +// JCDLStorage constants: +#define JC_DL_STORAGE_MAX_FILES 16 +#define JC_DL_STORAGE_MAX_FILE_SIZE (32 * 1024 - 2) // 32KB - 2 byte system reserved + +// MIFARE CLASSIC Authentication Modes: +enum MIFARE_AUTHENTICATION +{ + MIFARE_AUTHENT1A = 0x60, + MIFARE_AUTHENT1B = 0x61, +}; + +// MIFARE PLUS AES Authentication Modes: +enum MIFARE_PLUS_AES_AUTHENTICATION +{ + MIFARE_PLUS_AES_AUTHENT1A = 0x80, + MIFARE_PLUS_AES_AUTHENT1B = 0x81, +}; + +enum MIFARE_PLUS_AES_KEY_TYPE +{ + MIFARE_PLUS_AES_KEY_A = 1, + MIFARE_PLUS_AES_KEY_B = 2, +}; + +// T2T authentication constants: +enum T2T_AUTHENTICATION +{ + T2T_NO_PWD_AUTH = 0, + T2T_RKA_PWD_AUTH = 1, + T2T_PK_PWD_AUTH = 3, + T2T_WITHOUT_PWD_AUTH = 0x60, + T2T_WITH_PWD_AUTH = 0x61, +}; + +// T4T authentication constants +enum T4T_AUTHENTICATION +{ + T4T_WITHOUT_PWD_AUTH = 0x60, + T4T_PK_PWD_AUTH = 0x80, + T4T_RKA_PWD_AUTH = 0x02, +}; + +enum ADDRESS_MODE +{ + ADDRESS_MODE_BLOCK = 0, + ADDRESS_MODE_SECTOR, +}; + +#define MAX_UID_LEN 10 +#define MAX_ATS_LEN 25 +#define ECC_SIG_LEN 32 + +// API Status Codes Type: +typedef enum UFCODER_ERROR_CODES +{ + UFR_OK = 0x00, + UFR_COMMUNICATION_ERROR = 0x01, + UFR_CHKSUM_ERROR = 0x02, + UFR_READING_ERROR = 0x03, + UFR_WRITING_ERROR = 0x04, + UFR_BUFFER_OVERFLOW = 0x05, + UFR_MAX_ADDRESS_EXCEEDED = 0x06, + UFR_MAX_KEY_INDEX_EXCEEDED = 0x07, + UFR_NO_CARD = 0x08, + UFR_COMMAND_NOT_SUPPORTED = 0x09, + UFR_FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER = 0x0A, + UFR_ADDRESSED_BLOCK_IS_NOT_SECTOR_TRAILER = 0x0B, + UFR_WRONG_ADDRESS_MODE = 0x0C, + UFR_WRONG_ACCESS_BITS_VALUES = 0x0D, + UFR_AUTH_ERROR = 0x0E, + UFR_PARAMETERS_ERROR = 0x0F, + UFR_MAX_SIZE_EXCEEDED = 0x10, + UFR_UNSUPPORTED_CARD_TYPE = 0x11, + + UFR_COMMUNICATION_BREAK = 0x50, + UFR_NO_MEMORY_ERROR = 0x51, + UFR_CAN_NOT_OPEN_READER = 0x52, + UFR_READER_NOT_SUPPORTED = 0x53, + UFR_READER_OPENING_ERROR = 0x54, + UFR_READER_PORT_NOT_OPENED = 0x55, + UFR_CANT_CLOSE_READER_PORT = 0x56, + UFR_BLE_INVALID_PAIRING = 0x57, + + UFR_I2C_BUS_ERROR = 0x6A, + UFR_ECC_STORAGE_ERROR = 0x6B, + + UFR_WRITE_VERIFICATION_ERROR = 0x70, + UFR_BUFFER_SIZE_EXCEEDED = 0x71, + UFR_VALUE_BLOCK_INVALID = 0x72, + UFR_VALUE_BLOCK_ADDR_INVALID = 0x73, + UFR_VALUE_BLOCK_MANIPULATION_ERROR = 0x74, + UFR_WRONG_UI_MODE = 0x75, + UFR_KEYS_LOCKED = 0x76, + UFR_KEYS_UNLOCKED = 0x77, + UFR_WRONG_PASSWORD = 0x78, + UFR_CAN_NOT_LOCK_DEVICE = 0x79, + UFR_CAN_NOT_UNLOCK_DEVICE = 0x7A, + UFR_DEVICE_EEPROM_BUSY = 0x7B, + UFR_RTC_SET_ERROR = 0x7C, + + ANTI_COLLISION_DISABLED = 0x7D, + NO_TAGS_ENUMERRATED = 0x7E, + CARD_ALREADY_SELECTED = 0x7F, + + // NDEF error codes + UFR_WRONG_NDEF_CARD_FORMAT = 0x80, + UFR_NDEF_MESSAGE_NOT_FOUND = 0x81, + UFR_NDEF_UNSUPPORTED_CARD_TYPE = 0x82, + UFR_NDEF_CARD_FORMAT_ERROR = 0x83, + UFR_MAD_NOT_ENABLED = 0x84, + UFR_MAD_VERSION_NOT_SUPPORTED = 0x85, + UFR_NDEF_MESSAGE_NOT_COMPATIBLE = 0x86, + + // Tag emulation mode errors: + FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90, + + // FTDI errors: + UFR_FT_STATUS_ERROR_1 = 0xA0, + UFR_FT_STATUS_ERROR_2 = 0xA1, + UFR_FT_STATUS_ERROR_3 = 0xA2, + UFR_FT_STATUS_ERROR_4 = 0xA3, + UFR_FT_STATUS_ERROR_5 = 0xA4, + UFR_FT_STATUS_ERROR_6 = 0xA5, + UFR_FT_STATUS_ERROR_7 = 0xA6, + UFR_FT_STATUS_ERROR_8 = 0xA7, + UFR_FT_STATUS_ERROR_9 = 0xA8, + + // MIFARE PLUS error codes + UFR_MFP_COMMAND_OVERFLOW = 0xB0, + UFR_MFP_INVALID_MAC = 0xB1, + UFR_MFP_INVALID_BLOCK_NR = 0xB2, + UFR_MFP_NOT_EXIST_BLOCK_NR = 0xB3, + UFR_MFP_COND_OF_USE_ERROR = 0xB4, + UFR_MFP_LENGTH_ERROR = 0xB5, + UFR_MFP_GENERAL_MANIP_ERROR = 0xB6, + UFR_MFP_SWITCH_TO_ISO14443_4_ERROR = 0xB7, + UFR_MFP_ILLEGAL_STATUS_CODE = 0xB8, + UFR_MFP_MULTI_BLOCKS_READ = 0xB9, + + // NT4H error codes + NT4H_COMMAND_ABORTED = 0xC0, + NT4H_LENGTH_ERROR = 0xC1, + NT4H_PARAMETER_ERROR = 0xC2, + NT4H_NO_SUCH_KEY = 0xC3, + NT4H_PERMISSION_DENIED = 0xC4, + NT4H_AUTHENTICATION_DELAY = 0xC5, + NT4H_MEMORY_ERROR = 0xC6, + NT4H_INTEGRITY_ERROR = 0xC7, + NT4H_FILE_NOT_FOUND = 0xC8, + NT4H_BOUNDARY_ERROR = 0xC9, + NT4H_INVALID_MAC = 0xCA, + NT4H_NO_CHANGES = 0xCB, + + // multiple units - return from the functions with ReaderList_ prefix in name + UFR_DEVICE_WRONG_HANDLE = 0x100, + UFR_DEVICE_INDEX_OUT_OF_BOUND, + UFR_DEVICE_ALREADY_OPENED, + UFR_DEVICE_ALREADY_CLOSED, + UFR_DEVICE_IS_NOT_CONNECTED, + + // Originality Check Error Codes: + UFR_NOT_NXP_GENUINE = 0x200, + UFR_OPEN_SSL_DYNAMIC_LIB_FAILED, + UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND, + + // DESFIRE Card Status Error Codes: + READER_ERROR = 0xBB7, // 2999 [dec] + NO_CARD_DETECTED = 0xBB8, // 3000 [dec] + CARD_OPERATION_OK = 0xBB9, // 3001 [dec] + WRONG_KEY_TYPE = 0xBBA, // 3002 [dec] + KEY_AUTH_ERROR = 0xBBB, // 3003 [dec] + CARD_CRYPTO_ERROR = 0xBBC, // 3004 [dec] + READER_CARD_COMM_ERROR = 0xBBD, // 3005 [dec] + PC_READER_COMM_ERROR = 0xBBE, // 3006 [dec] + COMMIT_TRANSACTION_NO_REPLY = 0xBBF, // 3007 [dec] + COMMIT_TRANSACTION_ERROR = 0xBC0, // 3008 [dec] + NOT_SUPPORTED_KEY_TYPE = 0xBC2, // 3010 [dec] + WRONG_FILE_TYPE = 0xBC3, // 3011 [dec] + + DESFIRE_CARD_NO_CHANGES = 0x0C0C, + DESFIRE_CARD_OUT_OF_EEPROM_ERROR = 0x0C0E, + DESFIRE_CARD_ILLEGAL_COMMAND_CODE = 0x0C1C, + DESFIRE_CARD_INTEGRITY_ERROR = 0x0C1E, + DESFIRE_CARD_NO_SUCH_KEY = 0x0C40, + DESFIRE_CARD_LENGTH_ERROR = 0x0C7E, + DESFIRE_CARD_PERMISSION_DENIED = 0x0C9D, + DESFIRE_CARD_PARAMETER_ERROR = 0x0C9E, + DESFIRE_CARD_APPLICATION_NOT_FOUND = 0x0CA0, + DESFIRE_CARD_APPL_INTEGRITY_ERROR = 0x0CA1, + DESFIRE_CARD_AUTHENTICATION_ERROR = 0x0CAE, + DESFIRE_CARD_ADDITIONAL_FRAME = 0x0CAF, + DESFIRE_CARD_BOUNDARY_ERROR = 0x0CBE, + DESFIRE_CARD_PICC_INTEGRITY_ERROR = 0x0CC1, + DESFIRE_CARD_COMMAND_ABORTED = 0x0CCA, + DESFIRE_CARD_PICC_DISABLED_ERROR = 0x0CCD, + DESFIRE_CARD_COUNT_ERROR = 0x0CCE, + DESFIRE_CARD_DUPLICATE_ERROR = 0x0CDE, + DESFIRE_CARD_EEPROM_ERROR_DES = 0x0CEE, + DESFIRE_CARD_FILE_NOT_FOUND = 0x0CF0, + DESFIRE_CARD_FILE_INTEGRITY_ERROR = 0x0CF1, + DESFIRE_CATD_AUTHENTICATION_DELAY = 0X0CAD, + + // uFCoder library errors: + UFR_NOT_IMPLEMENTED = 0x1000, + UFR_COMMAND_FAILED = 0x1001, + UFR_TIMEOUT_ERR = 0x1002, + UFR_FILE_SYSTEM_ERROR = 0x1003, + UFR_FILE_SYSTEM_PATH_NOT_EXISTS = 0x1004, + UFR_FILE_NOT_EXISTS = 0x1005, + UFR_FTD2XX_DLL_NOT_FOUND = 0x1006, + + // uFCoder library/licensing specific + UFR_JSON_INVALID = 0x1012, + UFR_LICENSE_INVALID = 0x1013, + UFR_LICENSE_SAVE_FAILED = 0x1014, + UFR_LICENSE_NOT_FOUND = 0x1015, + UFR_LICENSE_HAS_EXPIRED = 0x1016, + + // SAM module error codes: + UFR_SAM_APDU_ERROR = 0x2000, + UFR_SAM_AUTH_ERROR, + UFR_SAM_CRYPTO_ERROR, + + // TLS, HTTPS Error Codes: + TLS_ERR_OPENING_SOCKET = 0x5000, + TLS_ERR_NO_SUCH_HOST = 0x5001, + TLS_CONNECTING_ERROR = 0x5002, + TLS_ERR_SERVER_UNEXPECTEDLY_CLOSED_CONNECTION = 0x5003, + TLS_ERR_UNKNOWN_GIDS_CERTIFICATE_FORMAT = 0x5004, + TLS_ERR_SET_PIN_FOR_GIDS_CERT_ONLY = 0x5005, + TLS_ERR_GIDS_PIN_CODE_WRONG = 0x5006, + TLS_ERR_UNSUPPORTED_CERTIFICATE_TYPE = 0x5007, + TLS_ERR_PRIVATE_KEY_CONTEXT_WRONG = 0x5008, + + // JC cards APDU Error Codes: + UFR_APDU_JC_APP_NOT_SELECTED = 0x6000, + UFR_APDU_TRANSCEIVE_ERROR = 0xAE, + UFR_APDU_JC_APP_BUFF_EMPTY = 0x6001, + UFR_APDU_WRONG_SELECT_RESPONSE = 0x6002, + UFR_APDU_WRONG_KEY_TYPE = 0x6003, + UFR_APDU_WRONG_KEY_SIZE = 0x6004, + UFR_APDU_WRONG_KEY_PARAMS = 0x6005, + UFR_APDU_WRONG_SIGNING_ALGORITHM = 0x6006, + UFR_APDU_PLAIN_TEXT_MAX_SIZE_EXCEEDED = 0x6007, + UFR_APDU_UNSUPPORTED_KEY_SIZE = 0x6008, + UFR_APDU_UNSUPPORTED_ALGORITHMS = 0x6009, + UFR_APDU_PKI_OBJECT_NOT_FOUND = 0x600A, + UFR_APDU_MAX_PIN_LENGTH_EXCEEDED = 0x600B, + UFR_DIGEST_LENGTH_DOES_NOT_MATCH = 0x600C, + + // reserved: 0x6100, + CRYPTO_SUBSYS_NOT_INITIALIZED = 0x6101, + CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR = 0x6102, + CRYPTO_SUBSYS_MAX_HASH_INPUT_EXCEEDED = 0x6103, + CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM = 0x6104, + CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM = 0x6105, + CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM = 0x6106, + CRYPTO_SUBSYS_WRONG_SIGNATURE = 0x6107, + CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH = 0x6108, + CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE = 0x6109, + CRYPTO_SUBSYS_HASHING_ERROR = 0x610A, + CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS = 0x610B, + CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY = 0x610C, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS = 0x610D, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY = 0x610E, + + UFR_WRONG_PEM_CERT_FORMAT = 0x61C0, + + // X.509 specific statuses: + X509_CAN_NOT_OPEN_FILE = 0x6200, + X509_WRONG_DATA = 0x6201, + X509_WRONG_LENGTH = 0x6202, + X509_UNSUPPORTED_PUBLIC_KEY_TYPE = 0x6203, + X509_UNSUPPORTED_PUBLIC_KEY_SIZE = 0x6204, + X509_UNSUPPORTED_PUBLIC_KEY_EXPONENT = 0x6205, + X509_EXTENSION_NOT_FOUND = 0x6206, + X509_WRONG_SIGNATURE = 0x6207, + X509_UNKNOWN_PUBLIC_KEY_TYPE = 0x6208, + X509_WRONG_RSA_PUBLIC_KEY_FORMAT = 0x6209, + X509_WRONG_ECC_PUBLIC_KEY_FORMAT = 0x620A, + X509_SIGNATURE_NOT_MATCH_CA_PUBLIC_KEY = 0x620B, + X509_UNSUPPORTED_SIGNATURE_SCH = 0x620C, + X509_UNSUPPORTED_ECC_CURVE = 0x620D, + + // PKCS#7 specific statuses: + PKCS7_WRONG_DATA = 0x6241, + PKCS7_UNSUPPORTED_SIGNATURE_SCHEME = 0x6242, + PKCS7_SIG_SCH_NOT_MATCH_CERT_KEY_TYPE = 0x6243, + + PKCS7_WRONG_SIGNATURE = 0x6247, + + // MRTD specific statuses: + MRTD_SECURE_CHANNEL_SESSION_FAILED = 0x6280, + MRTD_WRONG_SOD_DATA = 0x6281, + MRTD_WRONG_SOD_LENGTH = 0x6282, + MRTD_UNKNOWN_DIGEST_ALGORITHM = 0x6283, + MRTD_WARNING_DOES_NOT_CONTAINS_DS_CERT = 0x6284, + MRTD_DATA_GROUOP_INDEX_NOT_EXIST = 0x6285, + MRTD_EF_COM_WRONG_DATA = 0x6286, + MRTD_EF_DG_WRONG_DATA = 0x6287, + MRTD_EF_DG1_WRONG_LDS_VERSION_LENGTH = 0x6288, + MRTD_VERIFY_CSCA_NOT_EXIST = 0x6289, + MRTD_VERIFY_WRONG_DS_SIGNATURE = 0x628A, + MRTD_VERIFY_WRONG_CSCA_SIGNATURE = 0x628B, + MRTD_MRZ_CHECK_ERROR = 0x628C, + MRTD_SESSION_NOT_INITIALIZED = 0x628D, + + // ICAO Master List specific statuses: + ICAO_ML_WRONG_FORMAT = 0x6300, + ICAO_ML_CAN_NOT_OPEN_FILE = 0x6301, + ICAO_ML_CAN_NOT_READ_FILE = 0x6302, + ICAO_ML_CERTIFICATE_NOT_FOUND = 0x6303, + ICAO_ML_WRONG_SIGNATURE = 0x6307, + + // EMV specific statuses + SYS_ERR_OUT_OF_MEMORY = 0x7001, + EMV_ERR_WRONG_INPUT_DATA = 0x7002, + EMV_ERR_MAX_TAG_LEN_BYTES_EXCEEDED = 0x7004, + EMV_ERR_TAG_NOT_FOUND = 0x7005, + EMV_ERR_TAG_WRONG_SIZE = 0x7006, + EMV_ERR_TAG_WRONG_TYPE = 0x7007, + EMV_ERR_IN_CARD_READER = 0x7008, + EMV_ERR_READING_RECORD = 0x7009, + EMV_ERR_PDOL_IS_EMPTY = 0x7010, + EMV_ERR_LIST_FORMAT_NOT_FOUND = 0x7011, + EMV_ERR_AFL_NOT_FOUND = 0x7012, + EMV_ERR_AID_NOT_FOUND = 0x7013, + + // ISO7816-4 Errors (R-APDU) - 2 SW bytes returned by the card, prefixed with 0x000A: + UFR_APDU_SW_TAG = 0x000A0000, + UFR_APDU_SW_OPERATION_IS_FAILED = 0x000A6300, + UFR_APDU_SW_WRONG_PIN_4_TRIES_REMAINING = 0x000A63C4, + UFR_APDU_SW_WRONG_PIN_3_TRIES_REMAINING = 0x000A63C3, + UFR_APDU_SW_WRONG_PIN_2_TRIES_REMAINING = 0x000A63C2, + UFR_APDU_SW_WRONG_PIN_1_TRIES_REMAINING = 0x000A63C1, + UFR_APDU_SW_WRONG_PIN_0_TRIES_REMAINING = 0x000A63C0, + UFR_APDU_SW_WRONG_LENGTH = 0x000A6700, + UFR_APDU_SW_SECURITY_STATUS_NOT_SATISFIED = 0x000A6982, + UFR_APDU_SW_AUTHENTICATION_METHOD_BLOCKED = 0x000A6983, + UFR_APDU_SW_DATA_INVALID = 0x000A6984, + UFR_APDU_SW_CONDITIONS_NOT_SATISFIED = 0x000A6985, + UFR_APDU_SW_WRONG_DATA = 0x000A6A80, + UFR_APDU_SW_FILE_NOT_FOUND = 0x000A6A82, + UFR_APDU_SW_RECORD_NOT_FOUND = 0x000A6A83, + UFR_APDU_SW_DATA_NOT_FOUND = 0x000A6A88, + UFR_APDU_SW_ENTITY_ALREADY_EXISTS = 0x000A6A89, + UFR_APDU_SW_INS_NOT_SUPPORTED = 0x000A6D00, + UFR_APDU_SW_NO_PRECISE_DIAGNOSTIC = 0x000A6F00, + + MAX_UFR_STATUS = 0x7FFFFFFF, + + UFR_DISPLAY_IMAGE_LOAD_ERROR = 0x8001, + UFR_DISPLAY_IMAGE_DIMENSION_ERROR = 0x8002, + UFR_DISPLAY_IMAGE_UNSUPPORTED_CHANNELS = 0x8003, + UFR_DISPLAY_WRITE_CMD_ERROR = 0x8004, + UFR_DISPLAY_READ_ACK_ERROR = 0x8005, + UFR_DISPLAY_WRITE_CMDEXT_ERROR = 0x8006, + UFR_DISPLAY_READ_RESPONSE_ERROR = 0x8007, + UFR_DISPLAY_TEXT_COUNT_OVERFLOW = 0x8008, + UFR_DISPLAY_INDEX_OVERFLOW = 0x8009, + UFR_DISPLAY_WRONG_SIMBOL_NUMB = 0x8010, + UFR_DISPLAY_COMMAND_FAILED = 0x8011 + +} UFR_STATUS; + +typedef enum UFCODER_SESSION_CODES +{ + UFR_SESSION_UNKNOWN_ERROR = 0x00, + UFR_SESSION_CLOSED = 0x01, + UFR_SESSION_EXPIRED = 0x02, + UFR_SESSION_DEVICE_DISCONNECTED = 0x03, + UFR_SESSION_DEVICE_FAILED_TO_CONNECT = 0x04, + + // BLE specific error codes + UFR_BLE_SESSION_ERROR_INVALID_PARAMETERS = 0x11, + UFR_BLE_SESSION_ERROR_INVALID_HANDLE = 0x12, + UFR_BLE_SESSION_ERROR_NOT_CONNECTED = 0x13, + UFR_BLE_SESSION_ERROR_OUT_OF_SPACE = 0x14, + UFR_BLE_SESSION_ERROR_OPERATION_CANCELLED = 0x15, + UFR_BLE_SESSION_ERROR_CONNECTION_TIMEOUT = 0x16, + UFR_BLE_SESSION_ERROR_UUID_NOT_ALLOWED = 0x17, + UFR_BLE_SESSION_ERROR_ALREADY_ADVERTISING = 0x18, + UFR_BLE_SESSION_ERROR_CONNECTION_LIMIT_REACHED = 0x19, + UFR_BLE_SESSION_ERROR_UNKNOWN_DEVICE = 0x20, + UFR_BLE_SESSION_ERROR_OPERATION_NOT_SUPPORTED = 0x21, + UFR_BLE_SESSION_ERROR_PEER_REMOVED_PAIRING_INFORMATION = 0x22, + UFR_BLE_SESSION_ERROR_ENCRYPTION_TIMED_OUT = 0x23, + UFR_BLE_SESSION_ERROR_TOO_MANY_LE_PAIRED_DEVICES = 0x24, + + // NFC specific error codes + + // Sesssion errors + UFR_NFC_SESSION_ERROR_FIRST_NDEF_TAG_READ = 0x30, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TERMINATED_UNEXPECTEDLY = 0x31, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TIMEOUT = 0x32, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_SYSTEM_IS_BUSY = 0x33, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_USER_CANCELED = 0x34, + + // NDEF errors + UFR_NFC_SESSION_ERROR_TAG_NOT_WRITABLE = 0x40, + UFR_NFC_SESSION_ERROR_TAG_SIZE_TOO_SMALL = 0x41, + UFR_NFC_SESSION_ERROR_TAG_UPDATE_FAILURE = 0x42, + UFR_NFC_SESSION_ERROR_ZERO_LENGTH_MESSAGE = 0x43, + + // Transceive errors + UFR_NFC_SESSION_ERROR_RETRY_EXCEEDED = 0x50, + UFR_NFC_SESSION_ERROR_TAG_CONNECTION_LOST = 0x51, + UFR_NFC_SESSION_ERROR_TAG_NOT_CONNECTED = 0x52, + UFR_NFC_SESSION_ERROR_TAG_RESPONSE_ERROR = 0x53, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_SESSION_INVALIDATED = 0x54, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_PACKET_TOO_LONG = 0x55, + + UFR_NFC_SESSION_ERROR_TAG_COMMAND_CONFIGURATION_INVALID_PARAMETERS = 0x56, + + // Other + UFR_NFC_SESSION_ERROR_UNSUPPORTED_FEATURE = 0x61, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER = 0x62, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER_LENGTH = 0x63, + UFR_NFC_SESSION_ERROR_PARAMETER_OUT_OF_BOUNDS = 0x64, + UFR_NFC_SESSION_ERROR_RADIO_DISABLED = 0x65, + UFR_NFC_SESSION_ERROR_SECURITY_VIOLATION = 0x66, + +} UFR_SESSION_STATUS; + +// DESFIRE key settings values +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE 0x09 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE 0x0F +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x01 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x08 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x0E +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x00 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x06 + +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x00 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x01 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x02 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x03 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x04 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x05 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x06 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x08 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x09 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0A +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0B +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTH_AUTH 0x0C +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTH_AUTH 0x0D +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0E +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0F + +enum E_ASYMMETRIC_KEY_TYPES +{ + RSA_PRIVATE_KEY = 0, + ECDSA_PRIVATE_KEY, + + ASYMMETRIC_KEY_TYPES_NUM +}; + +#define MAX_ECC_CURVE_NAME_LEN 30 + +enum E_ECC_CURVE_DEFINITION_TYPES +{ + ECC_CURVE_INDEX, + ECC_CURVE_NAME, + ECC_CURVE_DOMAIN_PARAMETERS, + + ECC_CURVE_DEFINITION_TYPES_NUM +}; + +enum E_SIGNATURE_SCHEMES +{ + SHA1_WITH_RSA, + SHA256_WITH_RSA, + SHA384_WITH_RSA, + SHA512_WITH_RSA, + SHA224_WITH_RSA, + SHA512_224_WITH_RSA, + SHA512_256_WITH_RSA, + + RSA_PSS, + + ECDSA_WITH_SHA1, + ECDSA_WITH_SHA256, + ECDSA_WITH_SHA384, + ECDSA_WITH_SHA512, + ECDSA_WITH_SHA224, + + SIGNATURE_SCHEMES_NUM // Don't change the order. NEVER! +}; +enum E_SIGNATURE_SCH_TYPES +{ + RSA_PKCS1, + RSA_PKCS1_PSS, + ECDSA, + + SIGNATURE_SCH_TYPES_NUM +}; +enum E_PUB_KEY_TYPES +{ + PUB_KEY_TYPE_RSA, + PUB_KEY_TYPE_ECDSA_NAMED_CURVE, + PUB_KEY_TYPE_ECDSA_DOMAIN_PARAMS, + + PUB_KEY_TYPES_NUM +}; + +enum E_BIT_ENCODINGS +{ + ENCODING_BIN, + ENCODING_HEX +}; + +enum E_CERTIFICATE_TYPES +{ + X509_PEM, + X509_DER, + X509_GIDS_NFC, + + E_CERTIFICATE_TYPES_NUM +}; + +enum E_ECC_CURVES +{ + secp112r1, + secp112r2, + secp128r1, + secp128r2, + secp160r1, + secp160r2, + secp160k1, + secp192r1, + prime192v2, + prime192v3, + secp192k1, + secp224r1, + secp224k1, + secp256r1, + secp256k1, + secp384r1, + secp521r1, + prime239v1, + prime239v2, + prime239v3, + brainpoolP160r1, + brainpoolP192r1, + brainpoolP224r1, + brainpoolP256r1, + brainpoolP320r1, + brainpoolP384r1, + brainpoolP512r1, + brainpoolP160t1, + brainpoolP192t1, + brainpoolP224t1, + brainpoolP256t1, + brainpoolP320t1, + brainpoolP384t1, + brainpoolP512t1, + + ECC_CURVES_NUM + + /* Not supported in uFCoder library yet: + sect113r1, + sect113r2, + sect131r1, + sect131r2, + sect163k1, + sect163r1, + sect163r2, + sect193r1, + sect193r2, + sect233k1, + sect233r1, + sect239k1, + sect283k1, + sect283r1, + sect409k1, + sect409r1, + sect571k1, + sect571r1 + */ +}; +// #define F2M_CURVES sect113r1 + +typedef struct +{ + uint8_t *serial; + uint8_t *subject; + uint8_t *issuer; + uint8_t *SKI; + uint8_t *AKI; + uint32_t serial_len; + uint32_t subject_len; + uint32_t issuer_len; + uint32_t SKI_len; + uint32_t AKI_len; +} icaoMlSearchCriteria_t; + +typedef struct +{ + uint32_t ecc_curve_field_type; + void *field_domain_params; // To be defined. For now only a named primary field curves are supported. +} ecc_curve_domain_params_t; + +typedef struct +{ + uint32_t ecc_curve_definition_type; // one of the E_ECC_CURVE_DEFINITION_TYPES + uint32_t ecc_curve_index; + char *ecc_curve_name; + ecc_curve_domain_params_t *ecc_curve_domain_params; +} ecc_key_param_t; + +enum E_MRTD_IMG_TYPE +{ + MRTD_IMG_JPEG = 0, + MRTD_IMG_JP2 = 1, + MRTD_IMG_JPEG2000 = 1, // Alias for the MRTD_IMG_JP2 + + MRTD_IMG_TYPE_UNKNOWN = 0xFFFFFFFF +}; + +typedef enum +{ + USER_PIN = 0, + SO_PIN, + USER_PUK, + SO_PUK +} dl_sec_code_t; + +enum E_PRINT_VERBOSE_LEVELS +{ + PRINT_NONE, + PRINT_ESSENTIALS, + PRINT_DETAILS, + PRINT_ALL_PLUS_STATUSES, +}; + +// SAM definition +typedef enum E_SAM_HW_VER +{ + SAM_UNKNOWN_TYPE, + SAM_T1AD2060_AV1_MODE, + SAM_T1AD2060_AV2_MODE, + SAM_T1AR1070_AV1_MODE, + SAM_T1AR1070_AV2_MODE +} SAM_HW_TYPE; + +// Reader status +typedef enum E_EMULATION_MODES +{ + TAG_EMU_DISABLED, + TAG_EMU_DEDICATED, + TAG_EMU_COMBINED, + TAG_EMU_AUTO_AD_HOC +} emul_modes_t; + +typedef enum E_EMULATION_STATES +{ + EMULATION_NONE, + EMULATION_IDLE, + EMULATION_AUTO_COLL, + EMULATION_ACTIVE, + EMULATION_HALT, + EMULATION_POWER_OFF +} emul_states_t; + +typedef enum E_PCD_MGR_STATES +{ + PCD_MGR_NO_RF_GENERATED, + PCD_MGR_14443A_POLLING, + PCD_MGR_14443A_SELECTED, + PCD_MGR_CE_DEDICATED, + PCD_MGR_CE_COMBO_START, + PCD_MGR_CE_COMBO, + PCD_MGR_CE_COMBO_IN_FIELD +} pcd_states_t; + +enum E_RGB_PORT_NAMES +{ + EXTERNAL_RGB_PORT, + INTERNAL_RGB_PORT +}; + +enum E_CUSTOM_UI_IDLE_MODES +{ + CUSTOM_UI_IDLE_MODE_NONE = 0, + CUSTOM_UI_IDLE_MODE_STATIC_LED, + CUSTOM_UI_IDLE_MODE_BLINKING_LED, + CUSTOM_UI_IDLE_MODES_NUMBER_INDICATOR +}; + +enum E_CUSTOM_UI_DETECTED_MODES +{ + CUSTOM_UI_DETECTED_MODE_NONE = 0, + CUSTOM_UI_DETECTED_MODE_STATIC_LED, + CUSTOM_UI_DETECTED_MODE_STATIC_LED_BEEP, + CUSTOM_UI_DETECTED_MODE_BEEP, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED_BEEP, + CUSTOM_UI_DETECTED_MODES_NUMBER_INDICATOR +}; + +enum E_ISO15693_PASSWORD_IDENTIFIERS +{ + PWD_READ = 0x01, + PWD_WRITE = 0x02, + PWD_PRIVACY = 0x04, + PWD_DESTROY = 0x08, + PWD_EAS_AFI = 0x10 +}; + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * @defgroup INTERNAL !!!INTERNAL!!! uFR API calls (Not for public SDK use) (remove from final revision) + * @{ + */ + /** @} */ // end of defgroup INTERNAL + + /** + * @defgroup UNDOCUMENTED UNDOCUMENTED uFR API calls (remove from final revision) + * @brief Excluded from docs due to the nature of their usage + * @{ + */ + /**@}*/ // end of defgroup INTERNAL + + /** @defgroup LibLic Library licensing + * @brief Prerequisite API calls for facilitating use of uFR MDK (Mobile Development Kit) with Android/iOS devices (usage of mobile device internal NFC antenna) + * @{ + */ + /** @} */ // end of LibLic + + /** @defgroup SingleReader Single Reader + * @{ + */ + /** @defgroup ReaderAndLibrary Reader and library + ** @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication + + /** @defgroup ReaderAndLibrary_Information Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information + + /** @defgroup ReaderAndLibrary_EEPROM EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM + + /** @defgroup ReaderAndLibrary_Signalization Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization + + /** @defgroup ReaderAndLibrary_RGBSignalization RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL. + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl Display Control + * @since uFCoder library version 6.0.5 + * + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFROnlineCommands uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands + + /** @defgroup ReaderAndLibrary_BaseHDUFR uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR + + /** @defgroup ReaderAndLibrary_NXPSAM Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM + + /** @defgroup ReaderAndLibrary_HelperFunc Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc + + /**@}*/ // end of defgroup ReaderAndLibrary + + /** @defgroup Card_Tag Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockRead(), BlockWrite(), LinearRead(), LinearWrite() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF + + /** @defgroup Card_Tag_NTAG_2XX NTAG2XX (Type 2) specific commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG + + /** @defgroup Card_Tag_NT4H NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H + + /** @defgroup Card_Tag_Mifare_Desfire Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire + + /** @defgroup Card_Tag_Mifare_Desfire_Light Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Desfire_Light + + /** @defgroup Card_Tag_Mifare_Plus Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Plus + + /** @defgroup Card_Tag_Ultralight_C Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Ultralight_C + + /** @defgroup Card_Tag_JavaCardApplication Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication + + /** @defgroup Card_Tag_CardFeatures Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4 ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4 + + /** @defgroup Card_Tag_CardFeatures_ISO7816 ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816 + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification + + /** @defgroup Card_Tag_CardFeatures_MRTD Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD + + /** @defgroup Card_Tag_CardFeatures_TLS TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS + + /** @defgroup Card_Tag_CardFeatures_EMV Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV + + /** @defgroup Card_Tag_CardFeatures_AntiCollision Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode + + /**@}*/ // end of defgroup Card_Tag_CardFeatures + + /**@}*/ // end of defgroup Card_Tag + + /** @defgroup Miscellaneous Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous + + /**@}*/ // end of defgroup SingleReader + + /** @defgroup MultiReader MultiReader + * @{ + ** @defgroup ReaderAndLibrary_ReaderList Handling multiple readers + * @brief If you want to communicate and use multiple readers from an application, you have to follow the + * initial procedure for enumerating uFR compatible devices and getting their handles + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_ReaderList + + /** @defgroup ReaderAndLibrary_M Reader and library + * @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication_M Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication_M + + /** @defgroup ReaderAndLibrary_Information_M Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information_M + + /** @defgroup ReaderAndLibrary_EEPROM_M EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM_M + + /** @defgroup ReaderAndLibrary_Signalization_M Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization_M + + /** @defgroup ReaderAndLibrary_RGBSignalization_M RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_M Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFROnlineCommands_M uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands_M + + /** @defgroup ReaderAndLibrary_BaseHDUFR_M uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR_M + + /** @defgroup ReaderAndLibrary_NXPSAM_M Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM_M + + /** @defgroup ReaderAndLibrary_HelperFunc_M Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc_M + + /**@}*/ // end of defgroup ReaderAndLibrary_M + + /** @defgroup Card_Tag_M Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General_M General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare_M Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockReadM(), BlockWriteM(), LinearReadM(), LinearWriteM() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF_M NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF_M + + /** @defgroup Card_Tag_NTAG_2XX_M NTAG2XX (Type 2) related commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG_2XX_M + + /** @defgroup Card_Tag_NT4H_M NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H_M + + /** @defgroup Card_Tag_Mifare_Desfire_M Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_M + + /** @defgroup Card_Tag_Mifare_Desfire_Light_M Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_Light_M + + /** @defgroup Card_Tag_Mifare_Plus_M Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Plus_M + + /** @defgroup Card_Tag_Ultralight_C_M Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Ultralight_C_M + + /** @defgroup Card_Tag_JavaCardApplication_M Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common_M Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common_M + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage_M DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage_M + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_M + + /** @defgroup Card_Tag_CardFeatures_M Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking_M Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking_M + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4_M ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4_M + + /** @defgroup Card_Tag_CardFeatures_ISO7816_M ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816_M + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M + + /** @defgroup Card_Tag_CardFeatures_MRTD_M Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD_M + + /** @defgroup Card_Tag_CardFeatures_TLS_M TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS_M + + /** @defgroup Card_Tag_CardFeatures_EMV_M Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV_M + + /** @defgroup Card_Tag_CardFeatures_AntiCollision_M Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision_M + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode_M Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode_M + + /**@}*/ // end of defgroup Card_Tag_CardFeatures_M + + /**@}*/ // end of defgroup Card_Tag_M + + /** @defgroup Miscellaneous_M Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous_M + + /**@}*/ // end of defgroup MultiReader + + /** @defgroup uFR_MDK uFR MDK (Mobile Development Kit) + * @since uFCoder library version 6.0.0 + * + * Using the internal NFC antenna of a mobile device is supported in the uFCoder library through the usage of ReaderOpenEx() with appropriate parameters. + * It is mandatory to obtain a valid DLogic license to make use of the uFR MDK. + * License can be obtained automatically through the ReaderOpenEx() API call. + * Or using the GetLicenseRequestData() and our online service found at: https://liblic.d-logic.com/
+ * Refer to @ref LibLic group for details. + * + * @{ + */ + /** @defgroup uFR_MDK_Android Android + * @brief uFR MDK for Android currently has support for the NTAG2XX, Mifare Classic®, Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * @{ + */ + /** @defgroup uFR_MDK_Android_NTAG2XX NTAG2XX with NDEF support + * @brief Supported API calls for NTAG2XX (e.g NTAG203/210/213/215/216) cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * read_ndef_record() + * * write_ndef_record() + * * write_ndef_record_mirroring() + * * write_ndef_record_mirroring_tt() + * * get_ndef_record_count() + * * erase_last_ndef_record() + * * erase_all_ndef_records() + * * ndef_card_initialization() + * * WriteNdefRecord_WiFi() + * * WriteNdefRecord_BT() + * * WriteNdefRecord_SMS() + * * WriteNdefRecord_Bitcoin() + * * WriteNdefRecord_GeoLocation() + * * WriteNdefRecord_NaviDestination() + * * WriteNdefRecord_Email() + * * WriteNdefRecord_Address() + * * WriteNdefRecord_AndroidApp() + * * WriteNdefRecord_Text() + * * WriteNdefRecord_StreetView() + * * WriteNdefRecord_Skype() + * * WriteNdefRecord_Whatsapp() + * * WriteNdefRecord_Viber() + * * WriteNdefRecord_Contact() + * * WriteNdefRecord_Phone() + * * ReadNdefRecord_WiFi() + * * ReadNdefRecord_Bitcoin() + * * ReadNdefRecord_GeoLocation() + * * ReadNdefRecord_NaviDestination() + * * ReadNdefRecord_Email() + * * ReadNdefRecord_Address() + * * ReadNdefRecord_AndroidApp() + * * ReadNdefRecord_Text() + * * ReadNdefRecord_StreetView() + * * ReadNdefRecord_Skype() + * * ReadNdefRecord_Whatsapp() + * * ReadNdefRecord_Viber() + * * ReadNdefRecord_Contact() + * * ReadNdefRecord_Phone() + * * ReadNdefRecord_SMS() + * * ReadNdefRecord_BT() + * * ParseNdefMessage() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_NTAG2XX + + /** @defgroup uFR_MDK_Android_Mifare Mifare Classic + * @brief Supported API calls for Mifare Classic cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * SectorTrailerWrite_PK() + * * SectorTrailerWriteUnsafe_PK() + * * ValueBlockRead_PK() + * * ValueBlockWrite_PK() + * * ValueBlockInSectorRead_PK() + * * ValueBlockInSectorWrite_PK() + * * ValueBlockIncrement_PK() + * * ValueBlockDecrement_PK() + * * ValueBlockInSectorIncrement_PK() + * * ValueBlockInSectorDecrement_PK() + * * LinearFormatCard_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Mifare + + /** @defgroup uFR_MDK_Android_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth() + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth() + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Desfire + + /** @defgroup uFR_MDK_Android_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_Android + + /** @defgroup uFR_MDK_iOS iOS + * @brief uFR MDK for IOS currently has support only for Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * + * @{ + */ + /** @defgroup uFR_MDK_iOS_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_iOS_Desfire + + + /** @defgroup uFR_MDK_IOS_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_IOS_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_iOS + + /**@}*/ // end of defgroup uFR_MDK + + //-------------------------------------------------------------------------------------------------- + /** + * @brief Used to generate license request necessary for obtaing valid uFCoder license separately. + * + * Parameter "license_request" will hold a JSON string value that is to be used for our online front-end service for generating an offline license. + * The online service is found at: https://liblic.d-logic.com/ + * + * @ingroup LibLic + * + * @param months Number of months requested for the license + * @param license_request JSON string formed with licensing parameters + * + */ + void DL_API GetLicenseRequestData(uint32_t months, OUT char *license_request); + + /** + * @brief Used to validate and store an offline Dlogic license for future usage. + * + * @ingroup LibLic + * + * @param license_str JSON string containing full license data + * + * @return Operation status + */ + UFR_STATUS DL_API SetLicenseData(c_string license_str); + + /** + * @brief Opens reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s. If you have more than one µFR Online device, ReaderOpen function will open the first one found, for the device not connected to the PC via cable, use ReaderOpenEx() instead. + *
+ * NOTE: On Android, using ReaderOpen() will establish communication with uFR Series readers connected via OTG cable. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen(void); + + /** + * @brief Opens a port of connected reader using readers family type. Useful for speed up opening for non uFR basic reader type (e.g. BaseHD with uFR support). + * + * Do not use this function for opening communication with µFR Online devices. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenByType(uint32_t reader_type); + + enum E_READER_TYPE + { + AUTO = 0, + UFR_TYPE = 1, + UFR_RS232_TYPE = 2, + BASEHD_UFR_TYPE = 3, + UFR_ONLINE_TYPE = 4, + INTERNAL_NFC = 5 + }; + + /** + * @brief Open reader communication port in several different ways. Can be used for establishing communication with COM port too. + * + * There is enumeration in uFCoder.h file called E_READER_TYPE with values: + * enum E_READER_TYPE + * { + * AUTO = 0, + * UFR_TYPE = 1, + * UFR_RS232_TYPE = 2, + * BASEHD_UFR_TYPE = 3, + * UFR_ONLINE_TYPE = 4, + * INTERNAL_NFC = 5 + * }; + * Values in this enumeration you can pass into ReaderOpenEx function as reader_type parameter.
+ * For example, if you pass 4 as reader_type it will only work with µFR Online Series devices, and then as port_name you can pass devices IP address or serial number (ex: “192.168.1.123” or “ON101390”), for port_interface you can pass ‘U’ for UDP, ‘T’ for TCP or 0. + * If you pass 0, it will automatically search for reader working mode (UDP or TCP) and open it. For argument you can pass 0 or µFR Nano device serial number to open it on 1Mbit/s (ex: “UN123456”).
+ * Using value 5 as reader_type implies usage of internal mobile device NFC. + * Upon a call to ReaderOpenEx with this parameter, the library will try to obtain license automatically via HTTP. + * On success, a valid license is stored for future use. On failure, it moves to looking up for stored licenses. Results other than UFR_OK status imply a corresponding error that occurred and as such use of internal mobile device NFC will be unavailable. + * When using 5 as reader_type, additionally you can specify port_interface parameter to decide whether to do online->offline validation or just offline. To use offline-only validation of a previously stored valid DLogic license, set port_interface to 1. + * Value 0 is default value for port_interface and implies online->offline license validation. + * More examples for port open are given in the “Reader Open Examples” document: + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-doc/blob/master/Reader_Open_Examples.pdf + * Examples: + * ReaderOpenEx(1, “COM1”, 0, 0) + * This example will open communication with µFR device attached to COM1 port on 1Mbit/s + * ReaderOpenEx(1, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR device on 1Mbit/s + * ReaderOpenEx(2, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR RS232 device on 115200 bit/s + * ReaderOpenEx(4, “ON123456”, ‘U’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on UDP protocol. + * ReaderOpenEx(4, “ON123456”, ‘T’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘U’, 0) + * This example will open communication with µFR Online reader with IP address 192.168.1.123 on UDP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘T’, 0) + * This will open communication with µFR Online reader with IP address 192.168.1.123 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, 0, 0) + * It will open communication with µFR Online reader with IP address 192.168.1.123 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, 0) + * It will open communication with µFR Online reader with serial number ON123456 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with serial number ON123456 + * ReaderOpenEx(4, “192.168.1.123”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with IP address 192.168.1.123 + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) When uFR Online reader works in BT serial mode or transparent mode, reader_type must be set to 1. + * @param port_name is c-string type used to open port by given serial name. If you provide NULL or empty string that is AUTO MODE which calls ReaderOpenEx() and all available ports on the system. serial port name, identifier, like "COM3" on Windows or "/dev/ttyS0" on Linux or "/dev/tty.serial1" on OS X or if you select FTDI, reader serial number like "UN123456", if reader have integrated FTDI interface When the UDP interface type is selected, port_name must be provided in “address:port” format. Like "192.168.1.162:8881" IP for UDP I/F + * @param port_interface type of communication interfaces (define interface which we use while connecting to the printer), supported value's: 0 : auto - first try FTDI than serial if port_name is not defined 1 : try serial / virtual COM port / interfaces 2 : try only FTDI communication interfaces 10 : try to open Digital Logic Shields with RS232 uFReader on Raspberry Pi (serial interfaces with GPIO reset) 84 ('T') : TCP/IP interface 85 ('U') : UDP interface 102 ('B'): BT serial interface. Android library only. 114 ('L'): BLE interface. Android library only. When uFR Online reader works in BT serial mode, port_interface must be set to 0 (Except Android). arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * @param arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenEx(uint32_t reader_type, IN c_string port_name, uint32_t port_interface, IN void *arg); + + /** + * @brief Opens uFR Online device by serial number. + * + * Function will open communication (UDP or TCP) with device based on its working mode. If function cannot find given serial number, it will open communication on serial port with 1Mbit/s. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param serial_number Pointer to const char array (c_string) containing devices serial number (ex. “ON101390”). + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen_uFROnline(c_string serial_number); + + /** + * @brief Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderReset(void); + + /** + * @brief Physical reset of reader communication port & tests the communication before returning a UFR_STATUS code. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetWait(void); + + /** + * @brief Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderClose(void); + + /** + * @brief This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestart(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderHwReset(void); + + /** + * @brief Used to get the FTDI D2XX driver version number. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major: Byte value indicating driver version major number + * @param version_minor: Byte value indicating driver version minor number + * @param build: Byte value indicating driver version build number + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor, VAR uint8_t *build); + + /** + * @brief Used to get the FTDI D2XX driver version number as c-string. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_str: buffer that will contain driver version as c-string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersionStr(OUT char *version_str); + + /** + * @brief Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderType(VAR uint32_t *lpulReaderType); + + /** + * @brief Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumber(VAR uint32_t *lpulSerialNumber); + + /** + * @brief Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information + * + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnected(VAR uint32_t *connected); + + /** + * @brief Store a new key or change existing key under provided index parameter. + * + * The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWrite(IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLock(IN const uint8_t *password); + + /** + * @brief Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlock(IN const uint8_t *password); + + /** + * @brief This function turns sound and light reader signals. + * + * Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignal(uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). + * + * Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolume(uint8_t sound_volume); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserData(OUT uint8_t *aucData); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExt(OUT uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 byte array containing user data + * @return Operation status + */ + UFR_STATUS DL_API WriteUserData(IN const uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 byte array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExt(IN const uint8_t *aucData); + + /** + * @brief Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). + * + * We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @ingroup Card_Tag_General + * + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardId(VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * @ingroup Miscellaneous + * + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSak(VAR uint16_t *atqa, VAR uint8_t *sak); + + /** + * @brief Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKey(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKey(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKey(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKey(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKey(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesWritten, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * The method for proving authenticity is determined by the suffix in the functions names. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKey(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKey(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKey(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKey(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKey(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKey(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKey(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. + * + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Provided Key mode (PK) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PK(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PK(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PK(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PK(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PK(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PK(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PK(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PK(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PK(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PK(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PK(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTime(VAR uint8_t *time); + + /** + * @brief Function sets the date and time into the device's RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param password pointer to the 8 bytes array containing password time pointer to the 6 bytes array containing date and time representation + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief This function is used in Common, Advance and Access Control set of functions. + * + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM. Maximal length of array is 128 bytes. + * + * Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * @param password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeSector(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeBlock(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BusAdminCardMake(uint32_t serial, IN uint8_t *password); + + /** + * @brief Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information + * + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescription(OUT uint8_t pSerialDescription[8]); + + /** + * @brief Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information + * + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumber(VAR uint8_t *build); + + /** + * @brief This function returns UID of card actually present in RF field of reader. It can handle all three known types : 4, 7 and 10 byte long UIDs. + * + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi-card (anti collision) mode: + //------------------------------------------------------------------------------ + /** + * @brief This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollision(void); + + /** + * @brief Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollision(void); + + /** + * @brief If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. + * + * Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCards(VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + /** + * @brief For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. + * + * First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * Before calling this function you have to call EnumCards() first. + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCards(OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + /** + * @brief Selects one of the cards which UID is on the actual UID list of the enumerated cards. + * + * If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCard(IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. + * + * Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCard(void); + + /** + * @brief Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatus(VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + //------------------------------------------------------------------------------ + /** + * @brief This function returns card type according to DlogicCardType enumeration. + * + * For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General + * + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardType(VAR uint8_t *lpucCardType); + + /** + * @brief This function returns card manufacturer as char* buffer (c-style string). + * + * For details, please refer to the ISO/IEC JTC1/SC17 STANDING DOCUMENT 5 + * + * @ingroup Card_Tag_General + * + * @param card_manufacturer_str manufacturer name as c_string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardManufacturer(OUT char *card_manufacturer_str); + + /** + * @brief This function returns 8 bytes of the T2T version. + * + * All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersion(OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). + * + * The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General + * + * @param lpulLinearSize pointer to variable which contain size of user data space lpulRawSize pointer to variable which contain size of total data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSize(VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * @ingroup Miscellaneous + * + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatus(OUT uint8_t *tt_message, VAR uint8_t *tt_status); + //------------------------------------------------------------------------------ + /** + * @brief Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. + * + * The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @ingroup Card_Tag + * + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalData(OUT uint8_t data[32], VAR uint32_t *len); + + /** + * @brief Function returns reader’s serialized discovery loop structure. + * + * C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetup(OUT uint8_t *setupStruct, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoop(IN const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Function returns the AID set in the reader to retrieve the mobile phone's unique ID. + * + * If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAid(OUT uint8_t *aid, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAid(IN const uint8_t *aid, uint32_t len); + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfig(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtp(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlot(uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKey(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencrypted(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKey(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZone(uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZone(uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatus(VAR uint8_t *bool_config_zone_locked, VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevision(uint8_t revision[4]); + //------------------------------------------------------------------------------ + + // uFCoder PRO MODE + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProMode(VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProMode(const uint32_t ReaderProMode); + + // QR barcode crypt algorithm + // initialization. with TB serial like 'TB123456' + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_Initialize(IN const uint8_t *TBSerialString, uint16_t job_number); + + // You must define 25 bytes array in memory for out_card_data[] + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCard(const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + enum CARD_ENCRYPTION_CODE_TYPE + { + CODE_TYPE_STANDARD, + CODE_TYPE_GROUP, + CODE_TYPE_DAILY_RANGE, // valid from, but only to_timestamp / every day + }; + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNext(const uint32_t code_type, const uint32_t from_timestamp, const uint32_t to_timestamp, + const uint32_t additional_data_size, IN const uint8_t additional_data[], + VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSN(OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSN(VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSN(OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Function returns TNF, type of record, ID and payload from the NDEF record. + * + * NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_record(uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. + * + * Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, IN uint8_t *id, + IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, VAR uint8_t *card_formated); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_tt(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, + int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. + * + * Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_count(VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, OUT uint8_t *ndef_record_array, + VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_record(uint8_t message_nr); + + /** + * @brief Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_records(uint8_t message_nr); + + /** + * @brief Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. + * + * If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initialization(void); + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + /** + * @brief Function stores a message record for NTAG emulation mode into the reader. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdef(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief This function does the same as WriteEmulationNdef() function with the addition of an AAR embedded in to the NDEF message. + * + * AAR stands for “Android Application Record”. AAR is a special type of NDEF record that is used by Google’s Android operating system to signify to an NFC phone that an explicitly defined Android Application which should be used to handle an emulated NFC tag. Android App record will be added as the 2nd NDEF record in the NDEF message. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record type_record pointer to the array containing record type type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param type_record pointer to the array containing record type + * @param type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param id pointer to the array containing record ID + * @param id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param aar pointer to the array containing AAR record + * @param aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefWithAAR(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length, IN uint8_t *aar, uint8_t aar_length); + + /** + * @brief Put the reader permanently in a NDEF tag emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStart(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStop(void); + + /** + * @brief Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStart(void); + + /** + * @brief Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). + * + * uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStart(void); + + /** + * @brief Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStop(void); + + /** + * @brief This function returns current ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParams(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief This command set ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 CombinedModeEmulationStart Function description Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. Function declaration (C language) UFR_STATUS CombinedModeEmulationStart(void); Function takes no parameters. ________________ Support for ISO14443-4 protocol + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParams(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param is_field_present value representing whehter field is present (1) or not (0) + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldState(VAR uint8_t *is_field_present); + + /** + * @brief Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommMode(void); + + /** + * @brief The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommMode(void); + + /** + * @brief Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRam(IN uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data buffer containing ram data returned + * @param addr address from which to read reader RAM + * @param data_len length of data to read from RAM + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRam(OUT uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function stores a message record for NTAG emulation mode into the reader in the RAM. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRam(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, + IN uint8_t *id, uint8_t id_length, IN uint8_t *payload, uint32_t payload_length); + + /** + * @brief Put the reader permanently in a NDEF tag in RAM emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStopRam() function), or by reader reset. Use the function GetReaderStatus to check if the reader is still in emulation mode (maybe the reader was reset for some reason). + * From library version 5.0.31, and firmware version 5.0.31 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartRam(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopRam(void); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value sets to 0. + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value stays unchangeable. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterNonResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function disables the NFC counter in the card emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterDisabled(void); + + //------------------------------------------------------------------------------ + + // GetNfcT2TVersion() returns 8 bytes (see T2T documentation): + typedef struct t2t_version_struct + { + uint8_t header; + uint8_t vendor_id; + uint8_t product_type; + uint8_t product_subtype; + uint8_t major_product_version; + uint8_t minor_product_version; + uint8_t storage_size; + uint8_t protocol_type; + } t2t_version_t; + + // NfcT2TSafeConvertVersion() returns converts version_record that returned from GetNfcT2TVersion() + // or GetNfcT2TVersionM(). Conversion is "alignment safe" + // (you don't need to pay attention on structure byte alignment): + /** + * @brief This is a helper function for converting raw array of 8 bytes received by calling GetNfcT2TVersion(). + * + * All modern T2T chips having same or very similar structure of the T2T version data represented in the uFR API by the structure type t2t_version_t: + * typedef struct t2t_version_struct { + * uint8_t header; + * uint8_t vendor_id; + * uint8_t product_type; + * uint8_t product_subtype; + * uint8_t major_product_version; + * uint8_t minor_product_version; + * uint8_t storage_size; + * uint8_t protocol_type; + * } t2t_version_t; + * This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). Conversion done by this function is "alignment safe". + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param version pointer to the structure of the t2t_version_t type which will receive converted T2T version + * @param version_record pointer to array containing 8 bytes of the raw T2T version acquired using function GetNfcT2TVersion() + * + */ + void DL_API NfcT2TSafeConvertVersion(t2t_version_t *version, const uint8_t *version_record); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignature(OUT uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], VAR uint8_t *lpucUidLen, + VAR uint8_t *lpucDlogicCardType); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExt(OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + /** + * @brief This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounter(uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounter(uint8_t counter_address, uint32_t inc_value); + + /** + * @brief This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. + * + * If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounter(VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RK(VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Provided Key mode (PK) This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PK(VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfig(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigEx(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfig(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigEx(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only. Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode idle mode value + * @param card_detection_mode card detection mode value + * @param idle_color idle color value(RGB) + * @param card_detection_color card detection color value(RGB) + * @param enabled enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfig(uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only. Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode pointer to idle mode value + * @param card_detection_mode pointer to card detection mode value + * @param idle_color pointer to idle color value(RGB) + * @param card_detection_color pointer to card detection color value(RGB) + * @param enabled pointer to enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfig(uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_number(VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, uint8_t start_hour, + uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record(uint8_t record_number, VAR uint16_t *first_reader_nr, VAR uint16_t *last_reader_nr, + VAR uint8_t *start_hour, VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_record(uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_record(uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, uint8_t begin_hour, + uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, uint8_t end_hour, + uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_record(VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, VAR uint8_t *end_month, + VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_type(uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_type(VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_duration(uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_duration(VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_duration(uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_duration(VAR uint32_t *duration); + + // swimming pool ************************************************************** + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validity(VAR int32_t *credit, VAR uint32_t *begin_year, VAR uint32_t *begin_month, + VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, + VAR uint32_t *end_year, VAR uint32_t *end_month, VAR uint32_t *end_day, + VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validity(int32_t credit, uint32_t begin_year, uint32_t begin_month, uint32_t begin_day, + uint32_t begin_hour, + uint32_t begin_minute, + uint32_t end_year, uint32_t end_month, uint32_t end_day, uint32_t end_hour, + uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_record(uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_record(uint8_t record_number, VAR uint8_t *right_record_type, OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counter(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, + uint8_t end_minute, IN uint8_t *days, uint8_t max_daily_counter); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record_type_max_daily_counter(uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, + VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days, VAR uint8_t *max_daily_counter); + + //============================================================================= + + /** + * @brief Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOn(uint16_t pulse_duration); + + /** + * @brief Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayState(uint8_t state); + + /** + * @brief Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param intercom shows that there is voltage at the terminals for intercom connection, or notss + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoState(VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControl(uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Function gets the state of the input pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param input_nr ordinal number of hardware specific input pin input_state input state 1 or 0. + * @param input_state input state 1 or 0. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetInputState(uint8_t input_nr, VAR uint8_t *input_state); + + /** + * @brief This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControl(uint8_t light_status); + + /** + * @brief For classic uFR PLUS devices only. The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. + * + * This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControl(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Sets the color of the RGB diodes. + * + * This color stays on the RGB diodes until the function GreenLedBlinkingTurnOn() is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity(). + * Before this function call, the function GreenLedBlinkingTurnOff() must be called, or the reader is already in mode of blocking automatic signalization. + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControl(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControl(uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes. + * + * This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleep(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. + * + * In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. + * Function also sets the number of omitted activity periods, when the RGB light is off. + * For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriod(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSet(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefault(void); + + /** + * @brief The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. + * + * Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMax(uint8_t bad_select_nr_max); + + /** + * @brief The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMax(VAR uint8_t *bad_select_nr_max); + + /** + * @brief Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepMode(void); + + /** + * @brief Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepMode(void); + + /** + * @brief Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSet(uint8_t seconds_wait); + + /** + * @brief Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGet(VAR uint8_t *seconds_wait); + + /** + * @brief This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanently(unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParameters(VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. + * + * Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. + * The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. + * For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayData(IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Function has the same functionality as the function SetDisplayData(). New feature is the RGB port selection. + * + * Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbData(IN uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequency(uint16_t frequency); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * SetRgbIntensity()(alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * GetRgbIntensity (alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensity(VAR uint8_t *intensity); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRgbIntensity(VAR uint8_t *intensity); + // DESFIRE functions ************************************************************** + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode(void); + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATS(OUT uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorage(void); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceive(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint32_t *ufr_status); + + /** + * @brief Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Transceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, uint8_t data_out_len, + OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, uint8_t send_le, + OUT uint8_t *apdu_status); + + /** + * @brief Sends C–APDU in the c_string (zero terminated) format, containing pairs of the hexadecimal digits. + * + * Pairs of the hexadecimal digits can be delimited by any of the punctuation characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu C-APDU hexadecimal c_string + * @param r_apdu Received R-APDU as a hexadecimal c_string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceive(IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are sent and receive in the form of the byte arrays. + * + * There is obvious need for a c_apdu_len and *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceive(IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @param c_apdu array containing C_APDU + * @param c_apdu_len length of C_APDU + * @param r_apdu buffer that will store R_APDU + * @param r_apdu_len returns length of R_APDU + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeap(IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief This is “exploded binary” alternative function intended for support APDU commands in ISO 14443-4A tags. + * APDUTransceive() receives separated parameters which are an integral part of the C– APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls cls + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, uint32_t Nc, + OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chain(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint8_t *rcv_chained, + VAR uint32_t *ufr_status); + + /** + * @brief R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceive(uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselect(uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * @ingroup UNDOCUMENTED + * + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive(uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, uint8_t crypto1, + uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Function sets the parameters for transceive mode. + * + * If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_start(uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stop(void); + + /** + * @brief Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enable(void); + + /** + * @brief The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending rcv_data pointer to data array received from card bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceive(IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, uint32_t bytes_to_receive, + VAR uint32_t *rcv_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interface(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_Generic(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interface(void); + + /** + * @brief Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDU(void); + + /** + * @brief Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4(void); + + /** + * @brief Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interface(void); + + /** + * @brief APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interface(void); + + //============================================================================== + /** + * @brief Using this function you can select the appropriate application on the card. + * + * For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAid(IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief In JCApp cards you can put two types of asymmetric crypto keys. + * + * Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKey(uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + IN const uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPair(uint8_t key_type, uint8_t key_index, uint8_t key_designator, uint16_t key_bit_len, + IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPair(uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPair(uint8_t key_index); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBegin(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *chunk, + uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdate(IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEnd(VAR uint16_t *sig_len); + + /** + * @brief This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignature(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *plain_data, + uint16_t plain_data_len, VAR uint16_t *sig_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Finally, to get a signature, you have to call JCAppGetSignature(). + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior calling of this function you have to be logged in with an User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig Pointer to an array of “sig_len” bytes length. Value of the “sig_len” you've got as a parameter of the JCAppSignatureEnd() or JCAppGenerateSignature() functions. You have to allocate those bytes before calling this function. + * @param sig_len Length of the allocated bytes in a sig array. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetSignature(OUT uint8_t *sig, uint16_t sig_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObj(uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, uint8_t id_size); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubject(uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Using this function you can delete certificate objects from a card. + * + * This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCert(uint8_t obj_type, uint8_t obj_index); + + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjId(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubject(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObj(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + /** + * + * @ingroup Card_Tag_JavaCardApplication + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + c_string DL_API JCAppGetErrorDescription(UFR_STATUS apdu_error_status); + + /** + * @brief This function is used to login to the JCApp with an appropriate PIN code. + * + * Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. JCAppGetPinTriesRemaining Function description This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. This function have parameter of the type dl_sec_code_t which is defined as: typedef enum { USER_PIN = 0, SO_PIN, USER_PUK, SO_PUK } dl_sec_code_t; + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLogin(uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemaining(dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t. + * + * Which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code. + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChange(dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief This function is used to unblock PIN code which is specified by the SO parameter. + * + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblock(uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKey(uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, OUT uint8_t *exponent, + VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKey( + uint8_t key_index, OUT uint8_t *keyW, + VAR uint16_t *keyWSize, + OUT uint8_t *field, VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, VAR uint16_t *g_size, + OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBits(uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + //------------------------------------------------------------------------------ + /** + * @brief This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. + * + * Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list_size ointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSize(VAR uint32_t *list_size); + + /** + * @brief After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFiles(OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief This function returns file size indexed by the parameter card_file_index, on successful execution. + * + * Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file which size we want to get. + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSize(uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFile(uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief This function reads a file from the DLStorage card directly to the new file on the host file-system. + * + * If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. + * + * Parameter data_size defines the amount of data to be written in the file on the DLStorage card. + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFile(uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief This function writes file content from the host file-system to the new file on the DLStorage card. + * + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief After successful call to this function, the file on the DLStorage card will be deleted. + * + * Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFile(uint8_t file_index); + //------------------------------------------------------------------------------ + /** + * @brief This function is used to get hash output length in bytes for specified hash algorithms. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator for which we want to get output length in bytes. Use values declared in E_HASH_ALGS enumeration. + * @param out_byte_len After successful function execution, the variable on which this pointer points to, will contain output hash length in bytes for specified hash algorithm. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashOutputByteLength(uint32_t hash_algo, VAR uint32_t *out_byte_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions) + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHash(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, OUT uint8_t *hash, uint32_t hash_alocated); + + /** + * @brief This function calculates and returns the hash of the data in the buffer pointed by the “in” function parameter. + * + * Hash algorithm is specified by the hash_algo function parameter. + * If output bytes don't match with hash_alocated function parameter function returns CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH status. + * GetHashToHeap() automatically allocates memory, which *hash parameter will point to after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used for calculation. Use values declared in E_HASH_ALGS enumeration. + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions). + * @param hash After successful function execution, the variable on which this pointer points to, will contain the pointer to the output hash. + * @param hash_len After successful function execution, the variable on which this pointer points to, will contain output hash length. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashToHeap(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, VAR uint8_t **hash, VAR uint32_t *hash_len); + + /** + * @brief This function is used in conjunction with DLHashUpdateChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() has to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used in the following hashing sequence. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashInitChunked(uint32_t hash_algo); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param in One of the chunks of data of which hash is calculated. + * @param in_len Chunk length in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashUpdateChunked(IN const uint8_t *in, uint32_t in_len); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunked(OUT uint8_t *hash, uint32_t hash_alocated); + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * DLHashFinishChunkedToHeap() automatically allocates memory, which *hash parameter will point to, after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunkedToHeap(OUT uint8_t **hash, VAR uint32_t *hash_alocated); + + /** + * @brief This function is used to verify the digital signature of the pre-hashed value or some relatively short plain text message. + * + * If there is no errors during the verification process and digital signature correspond to the "To Be Signed" (TBS) data array and public cryptographic key, the function returns UFR_OK status. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * In case of wrong digital signature, function returns CRYPTO_SUBSYS_WRONG_SIGNATURE status. + * Function can return following status codes in case of various errors: + * * CRYPTO_SUBSYS_NOT_INITIALIZED + * * CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS + * * CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS + * * CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE + * * CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR + * For digest_alg use one of the values declared in E_SIGNER_DIGESTS enumeration: + * enum E_SIGNER_DIGESTS { + * ALG_NULL = 0, + * ALG_SHA, + * ALG_SHA_256, + * ALG_SHA_384, + * ALG_SHA_512, + * ALG_SHA_224, + * ALG_SHA_512_224, + * ALG_SHA_512_256, + * SIG_DIGEST_MAX_SUPPORTED + * }; + * ALG_SHA is the designator for the SHA-1 algorithm. + * For padding_alg use one of the values declared in E_SIGNER_RSA_PADDINGS enumeration: + * enum E_SIGNER_RSA_PADDINGS { + * PAD_NULL = 0, + * PAD_PKCS1_V1_5, + * PAD_PKCS1_PSS, + * SIG_PAD_MAX_SUPPORTED + * }; + * PAD_PKCS1 is an alias of the PAD_PKCS1_V1_5 padding algorithm: + * #define PAD_PKCS1 PAD_PKCS1_V1_5 + * For cipher_alg use one of the values declared in E_SIGNER_CIPHERS enumeration: + * enum E_SIGNER_CIPHERS { + * SIG_CIPHER_RSA = 0, + * SIG_CIPHER_ECDSA, + * SIG_CIPHER_MAX_SUPPORTED + * }; + * When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * + * @ingroup Card_Tag_CardFeatures_DigitalSignatureVerification + * + * @param digest_alg in the E_SIGNER_DIGESTS enumeration. + * @param padding_alg in the E_SIGNER_RSA_PADDINGS enumeration. When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * @param cypher_alg in the E_SIGNER_CIPHERS enumeration. tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * @param tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param signature Pointer to the signature array. + * @param signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. + * @param sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). + * @param pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. + * @param pub_key_params_len Length of the additional public key parameters (in bytes). + * + * @return Operation status + */ + UFR_STATUS DL_API DigitalSignatureVerifyHash(uint32_t digest_alg, uint32_t padding_alg, uint32_t cypher_alg, IN const uint8_t *tbs, + uint32_t tbs_len, IN const uint8_t *signature, uint32_t signature_len, + IN const void *sig_params, uint32_t sig_params_len, IN const uint8_t *pub_key, + uint32_t pub_key_len, IN const void *pub_key_params, uint32_t pub_key_params_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetHashName(uint32_t hash_algo); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the ECC curve designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param eccCurve ECC curve designator. Use values declared in E_ECC_CURVES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetEccCurveName(uint32_t eccCurve); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the signature scheme (signature algorithm) designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param signatureScheme Signature scheme (signature algorithm) designator. Use values declared in E_SIGNATURE_SCHEMES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetSignatureSchemeName(uint32_t signatureScheme); + + /** + * @brief Release the memory allocated from some of the library functions previously called making it available again for further allocations. + * + * Use to deallocate i.e. cleanup memory on the heap allocated. This function is a so-called helper for programming languages other than C/C++ where you can use a free(ptr) instead. Use only after calling the library functions for which it is explicitly indicated in this manual. Function returns nothing. After successful function execution ptr will point to NULL. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param ptr Pointer to the memory allocated on the heap which you want to release. If ptr does not point to a block of memory allocated with the library functions, it causes undefined behavior. If ptr is NULL, the function does nothing. Digital signature verification Enumerations, types and structures for use with DigitalSignatureVerifyHash function enum E_ECC_CURVE_DEFINITION_TYPES { ECC_CURVE_INDEX, ECC_CURVE_NAME, ECC_CURVE_DOMAIN_PARAMETERS, ECC_CURVE_DEFINITION_TYPES_NUM }; + * + */ + void DL_API DLFree(void *ptr); + //------------------------------------------------------------------------------ + /** + * @brief Initializes MRTD reader session using MRZ data. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number 9-character document number. + * @param birth_date 6-character birth date in "YYMMDD". + * @param expiry_date 6-character expiry date in "YYMMDD". + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SessionInit(IN const char *doc_number, IN const char *birth_date, IN const char *expiry_date); + + /** + * @brief Reads MRTD document data and returns it in JSON format. + * data includes name, surname, nationality, document number, inmage in base64 and more. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param json_buffer Buffer in which the JSON is stored, recommended size is 8192 mainly because of different possible image formats stored and their size. + * @param json_size Size of the buffer in which the JSON will be stored. Requires initial length to reflect the buffer and to be large enough to store the final JSON. + * On UFR_OK the value will be the actual size of JSON stored. UFR_BUFFER_OVERFLOW indicates that the buffer size was insufficient to store the JSON. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_ReadDocumentData(OUT char *json_buffer, VAR uint32_t *json_size); + + /** + * @brief Closes the MRTD session. This function should be called after MRTD_ReadDocumentData() function. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SessionClose(); + + /** + * @brief Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBac(IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], + VAR uint64_t *send_sequence_cnt); + + /** + * @brief Use this function to read files from the eMRTD NFC tag. + * + * You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param file_index Parameter that specifies the file we want to read from the eMRTD. This is a pointer to byte array containing exactly two bytes designating eMRTD file. Those two bytes are file identificator (FID) and there is a list of FIDs: EF.COM = {0x01, 0x1E} EF.DG1 = {0x01, 0x01} EF.DG2 = {0x01, 0x02} EF.DG3 = {0x01, 0x03} EF.DG4 = {0x01, 0x04} EF.DG5 = {0x01, 0x05} EF.DG6 = {0x01, 0x06} EF.DG7 = {0x01, 0x07} EF.DG8 = {0x01, 0x08} EF.DG9 = {0x01, 0x09} EF.DG10 = {0x01, 0x0A} EF.DG11 = {0x01, 0x0B} EF.DG12 = {0x01, 0x0C} EF.DG13 = {0x01, 0x0D} EF.DG14 = {0x01, 0x0E} EF.DG15 = {0x01, 0x0F} EF.DG16 = {0x01, 0x10} EF.SOD = {0x01, 0x1D} + * @param output After the successful call to this function, this pointer will point to the pointer on the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated during function execution. Maximum amount of data allocated can be 32KB. There is a programmer responsibility to cleanup allocated data (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * @param output_length After the successful call to this function, this pointer is pointed to the size of the file data read from an eMRTD file specified by the file_index parameter. + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeap(IN const uint8_t file_index[2], VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Extracts Document Signing (DS) certificate in ASN.1 DER format from SOD. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param[out] cert A pointer to a uint8_t pointer. This will point to the allocated memory containing the + * certificate (ASN.1 DER format). The user is responsible for freeing this memory using DLFree() + * after use. + * @param[out] certlen A pointer to a uint32_t that will store the length of the certificate. + * @param[in] ksenc A uint8_t array of size 16 containing the encryption key. + * @param[in] ksmac A uint8_t array of size 16 containing the MAC key. + * @param[in,out] send_sequence_cnt A pointer to a uint64_t that keeps track of the send sequence counter. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SOD_CertToHeap(VAR uint8_t **cert, VAR uint32_t *certlen, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief This function validates data groups read from the eMRTDocument. + * + * All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function.\ + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidate(IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, uint32_t verbose_level, + OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, you can call this function and pass it null terminated strings containing document number, document holder date of birth and document expiration date. + * + * After successful function execution MRZ Proto Key will be stored in a mrz_proto_key 25-byte array. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number Pointer to a null terminated string containing exactly 9 characters document number. + * @param date_of_birth Pointer to a null terminated string containing exactly 6 characters representing the date of birth in the “YYMMDD” format. + * @param date_of_expiry Pointer to a null terminated string containing exactly 6 characters representing expiration date in the “YYMMDD” format. + * @param mrz_proto_key This byte array will contain a calculated MRZ proto-key after successful function execution. This array must have allocated at least 25 bytes prior to calling this function. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_MRZDataToMRZProtoKey(IN const char *doc_number, IN const char *date_of_birth, IN const char *date_of_expiry, + OUT uint8_t mrz_proto_key[25]); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, in the case of the TD3 MRZ format (88 totally character long), you can call this function and pass it a null terminated string containing the MRZ subjacent row. + * + * Example of the TD3 MRZ format printed on the eMRTD document looks like this: + * P File 2, and overwrites the contents with data provided + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param data Array containing NDEF message data stored in a buffer to be written + * @param data_length length of the data to be written + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFMessage(IN uint8_t *data, uint32_t data_length); + + /** + * @brief Function used to read the whole NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param message pointer to array that will hold message data + * @param message_length length of the message that was read if successfull + * + * @return Operation status + */ + + UFR_STATUS DL_API uFR_int_DesfireReadNDEFMessage(OUT uint8_t *message, uint32_t *message_length); + /** + * @brief Function used to extract the payload of the NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param payload_str pointer to buffer that will hold payload data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadNDEFPayload(OUT char *payload_str); + + /** + * @brief Function used to write the payload of the NDEF message on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * The function takes in only c-string URI, and sets it's uri_identifier to 0 so it is not prefixed by anything when read. + * + * @param payload_str pointer to buffer that will hold message data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFPayload(IN c_string payload_str); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief The function allows the blinking of the green diode independently of the user's signaling command (default setting). + * + * This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOn(void); + + /** + * @brief The function prohibits the blinking of the green diode independently of the user's signaling command. + * + * LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOff(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOn(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOff(void); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeA(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeB(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212Default(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424Default(void); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeA(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeB(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t CWGsNOff, + uint8_t ModGsNOff); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API FastFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParameters(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrate(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersPN7462(OUT uint8_t *die_id, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, VAR uint8_t *fw_ver_build); + + // SAM + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_raw(OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version(VAR SAM_HW_TYPE *sam_type, OUT uint8_t *sam_uid); + + /** + * @brief Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_raw(uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param key_no key_no + * @param key_v key_v + * @param des_key des_key + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_des(uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * @ingroup UNDOCUMENTED + * + * @param aes_key_ver_a aes_key_ver_a + * @param ver_a ver_a + * @param aes_key_ver_b aes_key_ver_b + * @param ver_b ver_b + * @param aes_key_ver_c aes_key_ver_c + * @param ver_c ver_c + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_key(IN uint8_t *aes_key_ver_a, uint8_t ver_a, IN uint8_t *aes_key_ver_b, + uint8_t ver_b, IN uint8_t *aes_key_ver_c, uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param master_aes_key master_aes_key + * @param key_version key_version + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_mode(IN uint8_t *master_aes_key, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. + * + * A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plain(IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *keyA, IN uint8_t *keyB, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Ultralight C card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 8 bytes of DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_key(uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + uint8_t sam_lock_unlock, uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKey(uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeable(void); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfReset(void); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOn(void); + + /** + * @brief Function switch off RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderId(IN uint8_t *reader_id); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReader(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderUsb(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderStreamUsb(IN uint8_t *data, uint16_t packet_nr); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BootReader(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_CodeProtect(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParams(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParamsUsb(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_Test(uint8_t param); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdCalibration(uint8_t lpcd_threshold, OUT uint16_t *lpcd_reference); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdPerform(uint8_t lpcd_threshold, uint16_t lpcd_reference, VAR uint16_t *lpcd_agc, VAR uint8_t *lpcd_status); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOn(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ExtField(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ESP32_boot_init(IN uint8_t *reader_cnt, uint8_t reader_nr); + + // MIFARE PLUS + /** + * @brief Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePerso(uint16_t address, IN uint8_t *data); + + /** + * @brief Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPerso(void); + + /** + * @brief Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param card_master_key card_master_key + * @param card_config_key card_config_key + * @param level_2_switch_key level_2_switch_key + * @param level_3_switch_key level_3_switch_key + * @param level_1_auth_key level_1_auth_key + * @param select_vc_key select_vc_key + * @param prox_chk_key prox_chk_key + * @param vc_poll_enc_key vc_poll_enc_key + * @param vc_poll_mac_key vc_poll_mac_key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimal(IN uint8_t *card_master_key, IN uint8_t *card_config_key, IN uint8_t *level_2_switch_key, + IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, IN uint8_t *select_vc_key, + IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key); + + /** + * @brief Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current master key *new key pointer to 16 byte array containing the new master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new master key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new configuration key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) *configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PK(IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKey(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Key B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key_index new_key_index + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index, uint8_t new_key_type); + + /** + * @brief + * ADD DESCRIPTION + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param old_key old_key + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * @brief Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKey(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PK(IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key_index pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief + * Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PK(IN uint8_t *key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth_internal(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key_internal(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_internal(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceGet(uint32_t auth_mode, IN void *auth_value, VAR int32_t *credit); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceSet(uint32_t auth_mode, IN void *auth_value, int32_t credit); + + /** + * @brief This function sets communication speed (UART baud rate). + * + * Allowed values of baud rate are: 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, and 1000000 bps. All RS232 devices are supported, and USB devices (Nano FR, Classic) from firmware version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param baud_rate UART baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API SetUartSpeed(uint32_t baud_rate); + + /** + * @brief This function returns communication speed (UART baud rate) to default value. + * + * For RS23 devices default communication speed is 115200 bps, and for USB devices is 1000000 bps. + * For RS232 devices from version 5.0.1 (plus devices), and for USB devices from version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 1 - USB 2 - RS232 + * @param comm_type 1 - COM port 2 - FTDI + * @param port_name If comm_type is FTDI enter empty string If comm_type is COM port Windows “COMx” Linux “/dev/ttyUSBx” Mac OS “/dev/tty.usbserial-xxxxxxxx” + * + * @return Operation status + */ + UFR_STATUS DL_API SetDefaultUartSpeed(uint8_t reader_type, uint8_t comm_type, IN c_string port_name); + + // NT4H + /** + * @brief Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. + * + * This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parameters(uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Provided Key mode (PK) The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit read_ctr_limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Provided Key mode (PK) Function enables card Random ID. + * + * Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pk(IN uint8_t *aes_key_ext); + UFR_STATUS DL_API nt4h_unset_rid_pk(IN uint8_t *aes_key_ext); + + /** + * @brief Function enables card Random ID. Authentication with application master key (key number 0) required. + * + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid(uint8_t aes_key_no); + + /** + * @brief Provided Key mode (PK) Function returns card UID if Random ID activated. + * + * Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid(uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Provided Key mode (PK) Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pk(IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key(uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Provided Key mode (PK) Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pk(IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr(uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief No authentication. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_auth(uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Helper function for the MAC of SDM checking. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param mac_in_data data from mac_input_offset to mac_offset + * @param mac_in_len mac_input_offset - mac_offset + * @param sdm_mac pointer to array contained 8 bytes SDM MAC + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_check_sdm_mac(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *mac_in_data, IN uint8_t mac_in_len, IN uint8_t *sdm_mac); + + /** + * @brief Helper function for decryption of encrypted file data. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param enc_file_data pointer to array contained encrypted part of file data + * @param enc_file_data_len length of encrypted part of file data + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_sdm_enc_file_data(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *enc_file_data, IN uint8_t enc_file_data_len); + + /** + * @brief Helper function for decryption of encrypted PICC data. + * + * Function returns UID and SDM reading counter. Users need to know the AES key for metadata read (PICC data). + * + * @ingroup Card_Tag_NT4H + * + * @param picc_data pointer to array contained encrypted PICC data + * @param auth_key pointer to array contained AES meta data read key + * @param picc_data_tag if bit 7 set exist UID mirroring if bit 6 set exist SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param smd_read_cnt pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_picc_data(IN uint8_t *picc_data, IN uint8_t *auth_key, IN uint8_t *picc_data_tag, IN uint8_t *uid, IN uint32_t *smd_read_cnt); + + /** + * Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature(uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pk(IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status(uint8_t aes_key_no, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_auth(VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pk(IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt(uint8_t aes_key_no, uint8_t tt_status_key_no); + + // Desfire light + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param file_type file type 0 - standard data file, 2 - value file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param free_get_value value file get value without authentication (0 - disabled, 1 - enabled) + * @param record_size cyclic record file size of record + * @param max_number_of_rec cyclic record file maximal number of record + * @param curr_number_of_rec cyclic record file number of used record + * @param ex_unauth_operation TMC file exclude unauthorized operation + * @param tmc_limit_conf TMC file limit configuration + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param tmc_limit TMC file counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, VAR uint8_t *free_get_value, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *ex_unauth_operation, VAR uint8_t *tmc_limit_conf, VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, VAR uint32_t *tmc_limit); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered read_key_no read key number (0 - 4) write_key_no write key number (0 - 4) read_write_key_no read write key number (0 - 4) change_key_no change key number (0 - 4) + * @param key_no DESCRIPTION + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no currnent change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Function changes file settings of the Transaction MAC file. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no aes_key_no + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * @ingroup UNDOCUMENTED + * + * @param aes_key_ext aes_key_ext + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * @brief + * From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pk(IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file(uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in credit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of credit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_credit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in debit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of debit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_debit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in clear record operation. Function also returns decrypted Previous Reader ID. Users must enter file number, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_clear_record_transaction_mac(uint8_t file_no, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + // reader + /** + * @brief Function returns various reader states. + * + * From library version 5.0.31 and firmware version 5.0.33 + * The reader states are defined into following structures. This function is useful for checking if the reader is still in emulation mode after calling the TagEmulationStartRam() function. + * typedef enum E_EMULATION_MODES { + * TAG_EMU_DISABLED, + * TAG_EMU_DEDICATED, + * TAG_EMU_COMBINED, + * TAG_EMU_AUTO_AD_HOC + * }emul_modes_t; + * typedef enum E_EMULATION_STATES + * { + * EMULATION_NONE, + * EMULATION_IDLE, + * EMULATION_AUTO_COLL, + * EMULATION_ACTIVE, + * EMULATION_HALT, + * EMULATION_POWER_OFF + * }emul_states_t; + * typedef enum E_PCD_MGR_STATES + * { + * PCD_MGR_NO_RF_GENERATED, + * PCD_MGR_14443A_POLLING, + * PCD_MGR_14443A_SELECTED, + * PCD_MGR_CE_DEDICATED, + * PCD_MGR_CE_COMBO_START, + * PCD_MGR_CE_COMBO, + * PCD_MGR_CE_COMBO_IN_FIELD + * }pcd_states_t; + * + * @ingroup Miscellaneous + * + * @param state - normal working mode states are PCD_MGR_NO_RF_GENERATED or PCD_MGR_14443A_POLLING or PCD_MGR_14443A_SELECTED. - NTAG emulation mode state is PCD_MGR_CE_DEDICATED emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderStatus(VAR pcd_states_t *state, VAR emul_modes_t *emul_mode, VAR emul_states_t *emul_state, VAR uint8_t *sleep_mode); + + // EMV FUNCTIONS + + /** + * @brief Used for extracting the credit card PAN number. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param pan_str Pointer to char array containing credit card PAN. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetPAN(IN c_string df_name, OUT char *pan_str); + + /** + * @brief Used for extracting details about the last transaction stored in a credit card. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param last_transaction_info Pointer to char array containing details about the last transaction stored in the card. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetLastTransaction(IN c_string df_name, OUT char *last_transaction_info); + + + /** + * @brief Function is used for extracting image pixel values and storing them in the display for later use. This function will not render the image to the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param gallery_index - where in displays memory to store the bitmap(0-10) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveBitmapToGallery(const char *filename, int gallery_index); + + /** + * @brief Function takes an image and extracts it's pixel values and then just renders the on the display without storing the bitmap in the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param timeout - how long the bitmap should stay on display, 0-is indefinitely + * @param positionX - where on the display to start the bitmap. + * @param positionY - where on the display to start the bitmap. + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmap(const char *filename, uint32_t timeout, int positionX, int positionY); + + /** + * @brief Function renders an image that is stored in the display gallery. The gallery consist of 15 slots, of those 15 - 10 are used for storing bitmaps and the other 4 (11-15) are SystemBitmaps used by the display. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param gallery_index - which slot from the gallery to render on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmapFromGallery(int gallery_index); + + /** + * @brief Function allows you to change the essential symbols that the display regularly uses. These symbols include the Boot Image (ID-15), the Check bitmap(ID-14), and the Cross bitmap (ID-13). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param system_bitmap_index - ID of which system bitmap to change or import new (if slot is free 11-12) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveSystemBitmap(const char *filename, int system_bitmap_index); + + /** + * @brief Function renders the last image that was called with the function Display_ShowBitmap() + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowLastUnsavedImage(); + + /** + * @brief Function is used for communicating with the uFR device via I2C in COM protocol format. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param cmd - Command packet (read the "COM protocol" for more information) + * @param cmd_ext - Command extended packet, if cmd_ext is not being sent then should be "NULL" + * @param rsp - Array where the response will be written (at least 7 bytes) + * @return Operation status + */ + UFR_STATUS DL_API Display_Transmit(uint8_t *cmd, uint8_t *cmd_ext, uint8_t *rsp); + + /** + * @brief Function displays custom text on the screen. It can also enable text scrolling, position the text at a specific location on the display, and adjust the font size and style + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param customText - pointer to a string text + * @param fontStyle - number to change font style (0-1; 0 - default; 1 - not implemented) + * @param fontSize - number to change font size (0-1; 0 - 8x8 pixels; 1 - 16x16 pixels) + * @param scrollEnable - number to enable scroll (0-1) + * @param positionX - number containing X cordinate to place the text + * @param positionY - number containing Y cordinate to place the text + * @return Operation status + */ + UFR_STATUS DL_API Display_PrintText(const char *customText, int fontStyle, int fontSize, int scrollEnable, int positionX, int positionY); + + /** + * @brief Function displays a chec or a cross bitmap and, if a speaker is connected to the display, it triggers a function that produces a beep sound + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param signal - number to display a check or a cross symbol on the display (1-2; 1-cross; 2-check) + * @return Operation status + */ + UFR_STATUS DL_API Display_UserInterfaceSignal(int signal); + + /** + * @brief Function writes the time on the display. If the display is not connected to the Reader, the time will be displayed and remain unchanged. However, if the display is connected to the Reader, the time will be shown only for a second because the Reader is sending the correct time to the display every second. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param hour - number that represents the hour that will be drawn on the display + * @param minute - number that represents the minute that will be drawn on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowTime(int hour, int minute); + + /** + * @brief Function clears a specified section of the display. If xPosEND or yPosEND are set to 0, the function will automatically assume that the end postion for erasing extends to the edge of the screen (i.e., xPosEND will default to the display's maximum width, and yPosEND will default to it's maximum height). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param xPos - number containing X coordinate to clear on the display, start position + * @param xPosEND - number containing X coordinate to clear on the display, end position + * @param yPos - number containing Y coordinate to clear on the display, start position + * @param yPosEND - number containing Y coordinate to clear on the display, end position + * @return Operation status + */ + UFR_STATUS DL_API Display_EraseSection(int xPos, int xPosEND, int yPos, int yPosEND); + + /** + * @brief Function sets service data into EEPROM. Only use with production firmware. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param data pointer to array of 5 bytes which contains new service data + * @return Operation status + */ + UFR_STATUS DL_API SetServiceData(IN uint8_t *data); + + /** + * @brief Function gets service data from EEPROM. Use in diagnostic tool. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param data pointer to array which contains service data + * @return Operation status + */ + UFR_STATUS DL_API GetServiceData(OUT uint8_t *data); + + /** + * @brief Function gets number and types of the installed I2C devices at the reader + * @since uFCoder library version 6.0.18 + * + * @ingroup INTERNAL + * @param dev_num number of I2C devices found + * @param dev_bits bit array that represents types of I2C devices + * @return Operation status + */ + UFR_STATUS DL_API GetI2cDevicesStatus(uint8_t *dev_num, uint32_t *dev_bits); + + /** + * @brief Function gets lock status of the reader + * @since uFCoder library version 6.0.19 + * + * @ingroup INTERNAL + * @param lock_status + * @return Operation status + */ + UFR_STATUS DL_API GetReaderLockStatus(uint8_t *lock_status); + + /** + * @brief Function changes password at the NXP ICODE cards (provided passwords) + * @since uFCoder library version 6.0.13 + * + * @ingrup + * @param pwd_ident - Password Identifier + * @param current_password - pointer to the 4 bytes array that represents current password + * @param new_password - pointer to the 4 bytes array that represents new password + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password_PK(uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); + + /** + * @brief Function changes password at the NXP ICODE cards (reader's passwords) + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param pwd_ident - Password Identifier + * @param current_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @param new_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password(uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page_PK(IN uint8_t *read_password, IN uint8_t *write_password, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page(uint8_t read_pass_index, uint8_t write_pass_index, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function locks permanently the requested block on the ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API iso15693_lock_block_no_auth(uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block_PK(IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block(uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); + + /** + * @brief Function read the security status of the blocks from ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param first_block - address of the first block for security status reading + * @param number_of_blocks - number of blocks for security status reading + * @param block_data - pointer to the array of blocks security status (1 - block locked, 0 - block not locked). + * @return Operation status + */ + UFR_STATUS DL_API iso15693_get_multiply_block_security_status(uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + // XXX: Support for multiple readers with same DLL + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + + //-------------------------------------------------------------------------------------------------- + + ///--------------------------------------------------------------------- + /** + * @brief This is the first function in the order for execution for the multi-reader support. + * The function prepares the list of connected uF-readers to the system and returns the number of list items - number of connected uFR devices. + * ReaderList_UpdateAndGetCount() scans all communication ports for compatible devices, probes open readers if still connected, if not close and marks their handles for deletion. If some device is disconnected from the system this function should remove its handle. + * As of uFCoder version 5.0.73, this function probes both FTDI & COM devices and tries to open them. + * Each call to this method will close previously opened devices by this function, scan, and open everything found. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param NumberOfDevices how many compatible devices are connected to the system + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_UpdateAndGetCount(VAR int32_t *NumberOfDevices); + + /** + * @brief Used to retrieve information about a reader found & connected via ReaderList_UpdateAndGetCount(). + * This should be executed for each device based on number of devices found, providing valid index. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex index of the device in the readers list + * @param DeviceHandle assigned Handle + * @param DeviceSerialNumber device serial number + * @param DeviceType device type - device identification in AIS database + * @param DeviceFWver version of firmware + * @param DeviceCommID device identification number (master) + * @param DeviceCommSpeed communication speed + * @param DeviceCommFTDISerial FTDI COM port identification + * @param DeviceCommFTDIDescription FTDI COM port description + * @param DeviceIsOpened is Device opened + * @param DeviceStatus actual device status + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetInformation( // + uint32_t DeviceIndex, // index of the device to get information from + VAR UFR_HANDLE *DeviceHandle, //// assigned Handle + OUT c_string *DeviceSerialNumber, //// device serial number + VAR int *DeviceType, //// device type - device identification in AIS database + OUT c_string *DeviceFWver, //// version of firmware + VAR int *DeviceCommID, //// device identification number (master) + VAR int *DeviceCommSpeed, //// communication speed + OUT c_string *DeviceCommFTDISerial, //// FTDI COM port identification + OUT c_string *DeviceCommFTDIDescription, //// FTDI COM port description + VAR int *DeviceIsOpened, //// is Device opened + VAR int *DeviceStatus //// actual device status + ); + + /** + * @brief Force handle deletion when you identify that the reader is no longer connected, and want to release the handle immediately. If the handle exists in the list of opened devices, function would try to close communication port and destroy the handle. + * When uFR reader is disconnected, ReaderList_UpdateAndGetCount() will do that (destroy) automatically in next execution. + * + * @param DeviceHandle The handle that will be destroyed + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Destroy(UFR_HANDLE *DeviceHandle); + + /** + * @brief This method is used for manual addition of uFR devices to the list. Parameters used are the same as in ReaderOpenEx() method. Use this method if the device was not previously discovered by the ReaderList_UpdateAndGetCount() method. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceHandle the handle that will be assigned for interacting with the specified reader on success. + * @param reader_type Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_name Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_interface Refer to ReaderOpenEx() for detailed description of this parameter. arg Refer to ReaderOpenEx() for detailed description of this parameter. + * @param arg Refer to ReaderOpenEx() for detailed description of this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Add(UFR_HANDLE *DeviceHandle, uint32_t reader_type, + c_string port_name, uint32_t port_interface, void *arg); + + /** + * @brief Tries to re-open the device based on the serial number of the device. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param hndUFR handle of the uFR device + * @param Device_SN Serial number of the device contained as char array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenBySerial(VAR UFR_HANDLE *hndUFR, const char Device_SN[16]); + + // XXX: Obsolete functions - remain for backward compatibility + /** + * @brief + * Gets reader’s reader serial number as a pointer to 4 byte value, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulSerialNumber Contains reader serial number as a 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialByIndex(int32_t DeviceIndex, VAR uint32_t *lpulSerialNumber); + + /** + * @brief Gets reader’s descriptive name as a array of 8 chars, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param pSerialDescription Contains reader serial number as array of 8 chars + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialDescriptionByIndex(int32_t DeviceIndex, OUT uint8_t pSerialDescription[8]); + + /** + * @brief Gets devices reader type based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulReaderType Contains reader type as 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetTypeByIndex(int32_t DeviceIndex, VAR uint32_t *lpulReaderType); + + /** + * @brief Gets devices FTDI serial port number based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Serial Contains FTDI serial number as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDISerialByIndex(int32_t DeviceIndex, OUT char **Device_Serial); + + /** + * @brief Gets devices FTDI description based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Description FTDI description as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDIDescriptionByIndex(int32_t DeviceIndex, OUT char **Device_Description); + + /** + * @brief Tries to re-open the device based on the device index. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenByIndex(const int32_t DeviceIndex, VAR UFR_HANDLE *hndUFR); + + //-------------------------------------------------------------------------------------------------- + + // open first/next Reader and return handle - better to use ReaderList_OpenByIndex() + /** + * @brief Multi reader support. Open reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s, or if you have only one reader attached to another power supply (not your PC) it will open that reader based on it’s working mode (TCP or UDP). If you have more than one µFR Online device, ReaderOpen function will open the first one found, for opening another device, use ReaderOpenEx instead. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenM(VAR UFR_HANDLE *hndUFR); + +#ifdef ESP_PLATFORM + /** + * @brief @param hndUFR handle of the uFR device + * @param port_num + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderOpenM(VAR UFR_HANDLE *hndUFR, uint32_t port_num); +#endif + + /** + * @brief Multi reader support. Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderCloseM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTypeM(UFR_HANDLE hndUFR, OUT uint32_t *lpulReaderType); + + /** + * @brief Multi reader support. Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumberM(UFR_HANDLE hndUFR, OUT uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnectedM(UFR_HANDLE hndUFR, VAR uint32_t *connected); + + /** + * @brief Multi reader support. Store a new key or change existing key under provided index parameter.The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Multi reader support. Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. This function turns sound and light reader signals. Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignalM(UFR_HANDLE hndUFR, uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Multi reader support. From version 5.0.68. + * Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolumeM(UFR_HANDLE hndUFR, uint8_t sound_volume); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExtM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExtM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @param hndUFR handle of the uFR device + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * Multi reader support. From library version 5.0.36 and firmware version 5.0.37 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSakM(UFR_HANDLE hndUFR, uint16_t *atqa, uint8_t *sak); + + /** + * @brief Multi reader support. Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authenticationwith key A or key B:use KeyA - MIFARE_AUTHENT1A = 0x60or KeyB - MIFARE_AUTHENT1B = 0x61For NTAG 21x, Ultralight EV1 and other T2T tags supportingPWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead()or LinearRead_PK() functions. Value 0x60 with LinearRead() orLinearRead_PK() functions means “without PWD_AUTH“ and in thatcase you can send for ucReaderKeyIndex or aucProvidedKeyparameters anything you want without influence on the result. ForNTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTHyou can use _AKM1 or _AKM2 function variants only withoutPWD_AUTH in any case of the valid values (0x60 or 0x61) providedfor this parameter.For Mifare Plus tags (PK mode) defines whether to performauthentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCardM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKeyM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafeM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode)For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters + + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using absolute Block address. + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PKM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * Multi reader support. + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Multi reader support. Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + // New commands (for RTC & I2C EEPROM): + /** + * @brief Multi reader support. Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTimeM(UFR_HANDLE hndUFR, VAR uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into the device's RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password time + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTimeM(UFR_HANDLE hndUFR, IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Multi reader support. This function is used in Common, Advance and Access Control set of functions. + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPasswordM(UFR_HANDLE hndUFR, IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM. Maximal length of array is 128 bytes. Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWriteM(UFR_HANDLE hndUFR, IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescriptionM(UFR_HANDLE hndUFR, OUT uint8_t pSerialDescription[8]); + + // New since version 2.0: + /** + * @brief Multi reader support. Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumberM(UFR_HANDLE hndUFR, VAR uint8_t *build); + + /** + * @brief Multi reader support. This function returns UID of card actually present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief Multi reader support. This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi card mode: + //------------------------------------------------------------------------------ + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCardsM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + + /** + * @brief Multi reader support. Before calling this function you have to call EnumCards() first. + * For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCardsM(UFR_HANDLE hndUFR, OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + + /** + * @brief Multi reader support. Selects one of the cards which UID is on the actual UID list of the enumerated cards. If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCardM(UFR_HANDLE hndUFR, IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief Multi reader support. If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCardM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatusM(UFR_HANDLE hndUFR, VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns card type according to DlogicCardType enumeration. For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardTypeM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType); + + /** + * @brief Multi reader support. + * This function returns card manufacturer as char* buffer (c-style string). + * + * For details, please refer to the ISO/IEC JTC1/SC17 STANDING DOCUMENT 5 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param card_manufacturer_str manufacturer name as c_string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardManufacturerM(UFR_HANDLE hndUFR, OUT char *card_manufacturer_str); + + + /** + * @brief Multi reader support. This function returns 8 bytes of the T2T version. All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersionM(UFR_HANDLE hndUFR, OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Multi reader support. Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpulLinearSize pointer to variable which contain size of user data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSizeM(UFR_HANDLE hndUFR, VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * Multi reader support. From library version 5.0.59 and firmware version 5.0.60 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatusM(UFR_HANDLE hndUFR, OUT uint8_t *tt_message, VAR uint8_t *tt_status); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @param hndUFR handle of the uFR device + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @ingroup Card_Tag_M + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalDataM(UFR_HANDLE hndUFR, uint8_t data[32], uint32_t *len); + + /** + * @brief Multi reader support. Function returns reader’s serialized discovery loop structure i.e. C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetupM(UFR_HANDLE hndUFR, uint8_t *setupStruct, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoopM(UFR_HANDLE hndUFR, const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Multi reader support. Function returns the AID set in the reader to retrieve the mobile phone's unique ID. If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAidM(UFR_HANDLE hndUFR, uint8_t *aid, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAidM(UFR_HANDLE hndUFR, const uint8_t *aid, uint32_t len); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfigM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtpM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlotM(UFR_HANDLE hndUFR, uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKeyM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencryptedM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZoneM(UFR_HANDLE hndUFR, uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZoneM(UFR_HANDLE hndUFR, uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatusM(UFR_HANDLE hndUFR, VAR uint8_t *bool_config_zone_locked, + VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevisionM(UFR_HANDLE hndUFR, uint8_t revision[4]); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProModeM(UFR_HANDLE hndUFR, VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProModeM(UFR_HANDLE hndUFR, const uint32_t ReaderProMode); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_InitializeM(UFR_HANDLE hndUFR, IN const uint8_t *TBSerialString, uint16_t job_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCardM(UFR_HANDLE hndUFR, const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextM(UFR_HANDLE hndUFR, const uint32_t code_type, const uint32_t from_timestamp, + const uint32_t to_timestamp, const uint32_t additional_data_size, + IN const uint8_t additional_data[], VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSNM(UFR_HANDLE hndUFR, OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSNM(UFR_HANDLE hndUFR, VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSNM(UFR_HANDLE hndUFR, OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Multi reader support. Function returns TNF, type of record, ID and payload from the NDEF record. NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Multi reader support. Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, uint8_t *type_length, + IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, uint32_t *payload_length, + VAR uint8_t *card_formated); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroringM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_ttM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_countM(UFR_HANDLE hndUFR, VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, + OUT uint8_t *ndef_record_array, VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Multi reader support. Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_recordsM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initializationM(UFR_HANDLE hndUFR); + + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + + /** + * @brief Multi reader support. Function stores a message record for NTAG emulation mode into the reader. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefM(UFR_HANDLE hndUFR, uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, + uint8_t id_length, IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief Multi reader support. Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function returns current ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParamsM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. This command set ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParamsM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param is_field_present contains 0 if external field isn’t present or 1 if field is present. + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldStateM(UFR_HANDLE hndUFR, VAR uint8_t *is_field_present); + + /** + * @brief Multi reader support. Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. From library version 5.0.31, and firmware version 5.0.33 + * Function stores a message record for NTAG emulation mode into the reader in the RAM. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRamM(UFR_HANDLE hndUFR, uint8_t tnf, uint8_t *type_record, uint8_t type_length, + uint8_t *id, uint8_t id_length, uint8_t *payload, uint32_t payload_length); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking_M + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureM(UFR_HANDLE hndUFR, IN uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], + VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExtM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief Multi reader support. This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, uint32_t inc_value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successfulfunction execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterM(UFR_HANDLE hndUFR, VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RKM(UFR_HANDLE hndUFR, VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PKM(UFR_HANDLE hndUFR, VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Multi reader support. Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode sets idle mode value + * @param card_detection_mode sets card detection mode value + * @param idle_color sets idle color + * @param card_detection_color sets card detection color + * @param enabled value that enables it (1) or disables it (0) + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode returns idle mode value + * @param card_detection_mode returns card detection mode value + * @param idle_color returns idle color + * @param card_detection_color returns card detection color + * @param enabled returns 1 if enabled, 0 if disabled + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_numberM(UFR_HANDLE hndUFR, VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, VAR uint8_t *start_minute, + VAR uint8_t *end_hour, VAR uint8_t *end_minute, OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_recordM(UFR_HANDLE hndUFR, uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, + uint8_t begin_hour, uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, + uint8_t end_hour, uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_recordM(UFR_HANDLE hndUFR, VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, + VAR uint8_t *end_month, VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_typeM(UFR_HANDLE hndUFR, uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_typeM(UFR_HANDLE hndUFR, VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_durationM(UFR_HANDLE hndUFR, uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_durationM(UFR_HANDLE hndUFR, VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_durationM(UFR_HANDLE hndUFR, uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_durationM(UFR_HANDLE hndUFR, VAR uint32_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validityM(UFR_HANDLE hndUFR, VAR int32_t *credit, VAR uint32_t *begin_year, + VAR uint32_t *begin_month, VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, VAR uint32_t *end_year, VAR uint32_t *end_month, + VAR uint32_t *end_day, VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validityM(UFR_HANDLE hndUFR, int32_t credit, uint32_t begin_year, uint32_t begin_month, + uint32_t begin_day, uint32_t begin_hour, uint32_t begin_minute, uint32_t end_year, + uint32_t end_month, uint32_t end_day, uint32_t end_hour, uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint8_t *right_record_type, + OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counterM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, + uint16_t last_reader_nr, uint8_t start_hour, uint8_t start_minute, + uint8_t end_hour, uint8_t end_minute, IN uint8_t *days, + uint8_t max_daily_counter); + + //============================================================================= + + /** + * @brief Multi reader support. Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOnM(UFR_HANDLE hndUFR, uint16_t pulse_duration); + + /** + * @brief Multi reader support. Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayStateM(UFR_HANDLE hndUFR, uint8_t state); + + /** + * @brief Multi reader support. Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param intercom shows that there is voltage at the terminals for intercom connection, or not + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoStateM(UFR_HANDLE hndUFR, VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief + * Multi reader support. Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControlM(UFR_HANDLE hndUFR, uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Multi reader support. This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControlM(UFR_HANDLE hndUFR, uint8_t light_status); + + /** + * @brief Multi reader support. For classic uFR PLUS devices only. + * The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.55. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControlM(UFR_HANDLE hndUFR, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.64. + * The function sets color on the RGB diodes. This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleepM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.66. + * The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. Function also sets the number of omitted activity periods, when the RGB light is off. For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriodM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSetM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, uint8_t bad_select_nr_max); + + /** + * @brief Multi reader support. The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, VAR uint8_t *bad_select_nr_max); + + /** + * @brief Multi reader support. Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSetM(UFR_HANDLE hndUFR, uint8_t seconds_wait); + + /** + * @brief Multi reader support. Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGetM(UFR_HANDLE hndUFR, VAR uint8_t *seconds_wait); + + /** + * @brief Multi reader support. This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanentlyM(UFR_HANDLE hndUFR, unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Multi reader support. Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParametersM(UFR_HANDLE hndUFR, VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Multi reader support. Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayDataM(UFR_HANDLE hndUFR, IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Multi reader support. From version 5.0.55 + * Function has the same functionality as the function SetDisplayData. New feature is the RGB port selection. Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief Multi reader support. This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequencyM(UFR_HANDLE hndUFR, uint16_t frequency); + + /** + * @brief Multi reader support. SetRgbIntensity (alias from version 5.0.55) + * Function sets the intensity of light on the display. Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensityM(UFR_HANDLE hndUFR, uint8_t intensity); + + /** + * @brief Multi reader support. GetRgbIntensity (alias from version 5.0.55) + * Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensityM(UFR_HANDLE hndUFR, VAR uint8_t *intensity); + + // ############################################################################# + // ############################################################################# + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_ModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATSM(OUT UFR_HANDLE hndUFR, uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorageM(UFR_HANDLE hndUFR); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceiveM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint32_t *ufr_status); + /** + * @brief Multi reader support. + * Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_TransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, + uint8_t data_out_len, OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, + uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * Sends C–APDU in the c_string (zero terminated) format, containing pairs of the + hexadecimal digits. Pairs of the hexadecimal digits can be delimited by any of the punctuation + characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu C_APDU as string + * @param r_apdu R_APDU returned as string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceiveM(UFR_HANDLE hndUFR, IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief Multi reader support. + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are + sent and receive in the form of the byte arrays. There is obvious need for a c_apdu_len and + *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, + respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, + VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief Multi reader support. + * This is “exploded binary” alternative function intended for support APDU commands in ISO 14443- + 4A tags. APDUTransceive() receives separated parameters which are an integral part of the C– + APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls lcs + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, + uint32_t Nc, OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chainM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceiveM(UFR_HANDLE hndUFR, uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselectM(UFR_HANDLE hndUFR, uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceiveM(UFR_HANDLE hndUFR, uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, + uint8_t crypto1, uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Multi reader support. Function sets the parameters for transceive mode. If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_startM(UFR_HANDLE hndUFR, uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief Multi reader support. + * The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enableM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceiveM(UFR_HANDLE hndUFR, IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, + uint32_t bytes_to_receive, VAR uint32_t *rcv_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interfaceM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_GenericM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDUM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4M(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Using this function you can select the appropriate application on the card. For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAidM(UFR_HANDLE hndUFR, IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief Multi reader support. In JCApp cards you can put two types of asymmetric crypto keys. Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + const IN uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_type key_type + * @param key_index key_index + * @param key_designator key_designator + * @param key_bit_len key_bit_len + * @param params params + * @param params_size params_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPairM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, uint8_t key_designator, + uint16_t key_bit_len, IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBeginM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *chunk, uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdateM(UFR_HANDLE hndUFR, IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Multi reader support. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEndM(UFR_HANDLE hndUFR, VAR uint16_t *sig_len); + + /** + * @brief Multi reader support. + * This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignatureM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *plain_data, uint16_t plain_data_len, VAR uint16_t *sig_len, + IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, + uint8_t id_size); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Multi reader support. + * Using this function you can delete certificate objects from a card. This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCertM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index); + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjIdM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + + /** + * @brief Multi reader support. + * This function is used to login to the JCApp with an appropriate PIN code. Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLoginM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief Multi reader support. This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemainingM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief Multi reader support. This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChangeM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief Multi reader support. + * This function is used to unblock PIN code which is specified by the SO parameter. + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblockM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, + OUT uint8_t *exponent, VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *keyW, VAR uint16_t *keyWSize, OUT uint8_t *field, + VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, + VAR uint16_t *g_size, OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, + VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); // when keyW == NULL, returns size + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBitsM(UFR_HANDLE hndUFR, uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list_size Pointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSizeM(UFR_HANDLE hndUFR, VAR uint32_t *list_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFilesM(UFR_HANDLE hndUFR, OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief Multi reader support. + * This function returns file size indexed by the parameter card_file_index, on successful execution. Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file which size we want to get + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSizeM(UFR_HANDLE hndUFR, uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated d Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief Multi reader support. + * This function reads a file from the DLStorage card directly to the new file on the host file-system. If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. Parameter data_size defines the amount of data to be written in the file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief Multi reader support. + * This function writes file content from the host file-system to the new file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * After successful call to this function, the file on the DLStorage card will be deleted. Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFileM(UFR_HANDLE hndUFR, uint8_t file_index); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBacM(UFR_HANDLE hndUFR, IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], + OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * Use this function to read files from the eMRTD NFC tag. You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param file_index file index + * @param output buffer that storese output + * @param output_length length of the returned output + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt send_sequence_cnt + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *file_index, VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Extracts Document Signing (DS) certificate in ASN.1 DER format from SOD. + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param[in] hndUFR The handle to the uFR reader. + * @param[out] cert A pointer to a uint8_t pointer. This will point to the allocated memory containing the + * certificate (ASN.1 DER format). The user is responsible for freeing this memory using DLFree() + * after use. + * @param[out] certlen A pointer to a uint32_t that will store the length of the certificate. + * @param[in] ksenc A uint8_t array of size 16 containing the encryption key. + * @param[in] ksmac A uint8_t array of size 16 containing the MAC key. + * @param[in,out] send_sequence_cnt A pointer to a uint64_t that keeps track of the send sequence counter. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SOD_CertToHeapM(UFR_HANDLE hndUFR, VAR uint8_t **cert, VAR uint32_t *certlen, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * This function validates data groups read from the eMRTDocument. All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * ________________ + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidateM(UFR_HANDLE hndUFR, IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, + uint32_t verbose_level, OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + // ############################################################################# + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Start(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StartM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Stop(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StopM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Start(void); // Alias for uFR_DESFIRE_Start() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StartM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StartM() + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Stop(void); // Alias for uFR_DESFIRE_Stop() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StopM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StopM() + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUidM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3desM(UFR_HANDLE hndUFR, IN uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Provided Key mode (PK) + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function returns the available bytes on the card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param free_mem_byte pointer to free memory size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFreeMemM(UFR_HANDLE hndUFR, VAR uint32_t *free_mem_byte, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCardM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * Provided Key mode (PK) + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + /** + * @brief Multi reader support. Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Provided Key mode (PK) + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key provided key + * Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * No authentication + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + // 121212 + /** + * @brief Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. + * + * If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * Multi reader support + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationd2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfigurationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. Provided Key mode (PK) + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. No authentication + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Function allows to set card master key, and application master key configuration settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr ordinal number of AES key in the reader + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_2k3des_key_nr, uint8_t aid_key_no, uint8_t old_2k3des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_2k3des_key_nr, uint8_t aid_key_no, + uint8_t old_2k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key_nr ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_des3k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_3k3des_key_nr, uint8_t aid_key_no, + uint8_t old_3k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of the key stored in the reader + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. 128 bit AES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_des_key[8], uint8_t aid_key_no, IN uint8_t old_des_key[8], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_des_key[8], uint8_t aid_key_no, + IN uint8_t old_des_key[8], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key pointer to 32 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key 24 bytes array that represent 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key 24 bytes array that represent current 3K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des3k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_3k3des_key[24], uint8_t aid_key_no, + IN uint8_t old_3k3des_key[24], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key pointer to array contained new AES key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t auth_key_type, IN uint8_t *new_key, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr key index of AES key stored in the reader that will be new AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr key index of AES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeAesKey_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des3k_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_des3k_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange3k3desKey_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des3k_key_nr, uint8_t aid_key_no, uint8_t old_des3k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows you to change any AES key on the card. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. *only uFR CS with SAM support + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of a key stored in the reader that will be new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief + * Function writes AES key (16 bytes) into reader. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key in the reader (0 - 15) + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_no, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Function writes AES key (16 bytes) into reader. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param key_no ordinal number of key in the reader (0 - 15) + * @param key pointer to array containing the key + * @param key_type enumerated key type (0 - 3) + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteKeyM(UFR_HANDLE hndUFR, uint8_t key_no, IN uint8_t *key, uint8_t key_type); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIdsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_no_auth_M(UFR_HANDLE hndUFR, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t number_of_records, uint16_t record_size, uint8_t communication_settings, + uint8_t *data, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + uint8_t *data, + uint16_t *card_status, + uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuth_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileDesAuth_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile2k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. Provided Key mode (PK) + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multireader support. 128 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no ey for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsSdmAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows changing of file settings + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * *only uFR CS with SAM support + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetTransactionTimerAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). . + * + * Multi reader support. + * From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param card_uid 7 bytes length card UID + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireUidReadECCSignatureM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, OUT uint8_t *card_uid, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aesM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOnM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function prohibits the blinking of the green diode independently of the user's signaling command. LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOffM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOnM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOffM(UFR_HANDLE hndUFR); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t CWGsNOff, uint8_t ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API FastFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersM(UFR_HANDLE hndUFR, uint8_t *mui, uint8_t *serial_nr, uint8_t *hw_type, uint8_t *hw_ver, + uint8_t *device_type, uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrateM(UFR_HANDLE hndUFR, OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersPN7462_M(UFR_HANDLE hndUFR, uint8_t *die_id, uint8_t *serial_nr, + + uint8_t *hw_type, uint8_t *hw_ver, uint8_t *device_type, + uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + // SAM + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_rawM(UFR_HANDLE hndUFR, OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_versionM(UFR_HANDLE hndUFR, VAR SAM_HW_TYPE *sam_type, VAR uint8_t *sam_uid); + + /** + * @brief Multi reader support. Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_rawM(UFR_HANDLE hndUFR, uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_v ADD DESCRIPTION + * @param des_key ADD DESCRIPTION + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_desM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_keyM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param master_aes_key ADD DESCRIPTION + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_modeM(UFR_HANDLE hndUFR, IN uint8_t *master_aes_key, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plainM(UFR_HANDLE hndUFR, IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *keyA, + IN uint8_t *keyB, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_ULC_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_desfire_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, + uint8_t ver_a, IN uint8_t *aes_key_ver_b, uint8_t ver_b, + IN uint8_t *aes_key_ver_c, uint8_t ver_c, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, uint8_t sam_lock_unlock, + uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKeyM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * Multi reader support. + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeableM(UFR_HANDLE hndUFR); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * Multi reader support. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfResetM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOnM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch off RF field at the reader. + * + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOffM(UFR_HANDLE hndUFR); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderIdM(UFR_HANDLE hndUFR, uint8_t *reader_id); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePersoM(UFR_HANDLE hndUFR, uint16_t address, IN uint8_t *data); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPersoM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param card_master_key pointer to 16 byte array containing the card master key + * @param card_config_key pointer to 16 byte array containing the card configuration key + * @param level_2_switch_key pointer to 16 byte array containing the key for switch to security level 2 + * @param level_3_switch_key pointer to 16 byte array containing the key for switch to security level 3 + * @param level_1_auth_key pointer to 16 byte array containing the key for optional authentication at security level 1 + * @param select_vc_key pointer to 16 byte array containing the key for virtual card selection + * @param prox_chk_key pointer to 16 byte array containing the key for proximity check + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling + * @param vc_poll_mac_key pointer to 16 byte array containing the MAC key for virtual card polling + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimalM(UFR_HANDLE hndUFR, IN uint8_t *card_master_key, IN uint8_t *card_config_key, + IN uint8_t *level_2_switch_key, IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, + IN uint8_t *select_vc_key, IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, + IN uint8_t *vc_poll_mac_key); + + /** + * @brief Multi reader support. Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, + uint8_t prox_check_use); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ADordinary number of current sector key stored into reader that wile become new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKeyM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, + OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @param hndUFR handle of the uFR device + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PKM(UFR_HANDLE hndUFR, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief Multi reader support. Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PKM(UFR_HANDLE hndUFR, IN uint8_t *key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_authM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + + // ESP32 + /** + * @brief Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. + * + * Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayData(IN uint8_t *display_data, IN uint8_t data_length, uint16_t duration); + + /** + * @brief Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderReset(void); + + /** + * @brief It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM of uFR Online. + * + * Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param time pointer to the array containing current date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTime(OUT uint8_t *time); + + /** + * @brief Function sets the date and time into uFR Online RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOState(uint8_t pin, uint8_t state); + + /** + * @brief Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOState(OUT uint8_t *state); + + /** + * @brief Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReader(uint8_t reader); + + /** + * @brief Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param SerialNumber pointer to SerialNumber variable. “SerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumber(VAR uint32_t *SerialNumber); + + /** + * @brief Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersion(OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOff(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifi(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableWifi(void); + + // NDEF MESSAGES + //---------------------------------------------------------- + + enum NDEF_STORAGE_MODE + { + STORE_INTO_READER = 0, + STORE_INTO_CARD + }; + + enum NDEF_SKYPE_ACTION + { + CALL = 0, + CHAT + }; + + // WiFi NDEF authentication type + enum WIFI_AUTH_TYPE + { + OPEN = 0, + WPA_PERSONAL, + WPA_ENTERPRISE, + WPA2_ENTERPRISE, + WPA2_PERSONAL + }; + + // WiFi NDEF encryption type + enum WIFI_ENC_TYPE + { + NONE = 0, + WEP, + TKIP, + AES, + AES_TKIP + }; + + /** + * @brief + * Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFi(uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, uint8_t encryption_type, + IN const char *password); + + /** + * @brief Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters)(e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BT(uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMS(uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Bitcoin(uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocation(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestination(uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Email(uint8_t ndef_storage, IN const char *email_address, IN const char *subject, IN const char *message); + + /** + * @brief Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Address(uint8_t ndef_storage, IN const char *address); + + /** + * @brief Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidApp(uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Store text as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Text(uint8_t ndef_storage, IN const char *text); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetView(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Skype(uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Whatsapp(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Viber(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Contact(uint8_t ndef_storage, IN const char *name, IN const char *company, IN const char *address, + IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Phone(uint8_t ndef_storage, IN const char *phone_number); + + /** + * @brief Multi reader support. Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFiM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, + uint8_t encryption_type, IN const char *password); + + /** + * @brief Multi reader support. Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters) (e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BTM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Multi reader support. Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMSM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Multi reader support. Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BitcoinM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Multi reader support. Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_EmailM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *email_address, IN const char *subject, + IN const char *message); + + /** + * @brief Multi reader support. Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AddressM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *address); + + /** + * @brief Multi reader support. Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Multi reader support. Store text as NDEF message into reader or into card. + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_TextM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *text); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetViewM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SkypeM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Multi reader support. Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WhatsappM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ViberM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ContactM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *name, IN const char *company, + IN const char *address, IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Multi reader support. Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_PhoneM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number); + //--------------------------------------------------------------------------------------------- + /** + * @brief Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF + * + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFi(OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, OUT char *password); + + /** + * @brief Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Bitcoin(OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocation(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF + * + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestination(OUT char *destination); + + /** + * @brief Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Email(OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF + * + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Address(OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF + * + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidApp(OUT char *package_name); + + /** + * @brief Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF + * + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Text(OUT char *text); + + /** + * @brief Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetView(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF + * + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Skype(OUT char *user_name, OUT char *action); + + /** + * @brief Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Whatsapp(OUT char *message); + + /** + * @brief Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Viber(OUT char *message); + + /** + * @brief Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF + * + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Contact(OUT char *vCard); + + /** + * @brief Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Phone(OUT char *phone_number); + + /** + * @brief Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMS(OUT char *phone_number, OUT char *message); + + /** + * @brief Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BT(OUT char *bt_mac_address); + + /** + * @brief Multi reader support. Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFiM(UFR_HANDLE hndUFR, OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, + OUT char *password); + + /** + * @brief Multi reader support. Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BitcoinM(UFR_HANDLE hndUFR, OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, OUT char *destination); + + /** + * @brief Multi reader support. Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_EmailM(UFR_HANDLE hndUFR, OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AddressM(UFR_HANDLE hndUFR, OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, OUT char *package_name); + + /** + * @brief Multi reader support. Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_TextM(UFR_HANDLE hndUFR, OUT char *text); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetViewM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SkypeM(UFR_HANDLE hndUFR, OUT char *user_name, OUT char *action); + + /** + * @brief Multi reader support. Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WhatsappM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ViberM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ContactM(UFR_HANDLE hndUFR, OUT char *vCard); + + /** + * @brief Multi reader support. Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_PhoneM(UFR_HANDLE hndUFR, OUT char *phone_number); + + /** + * @brief Multi reader support. Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMSM(UFR_HANDLE hndUFR, OUT char *phone_number, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BTM(UFR_HANDLE hndUFR, OUT char *bt_mac_address); + + /** + * @brief Used to parse NDEF record into separate parameters + * + * @ingroup Card_Tag_NDEF + * + * @param type_record pointer to the array containing record type + * @param type_len length of the record type + * @param payload pointer to the array containing record payload + * @param payload_len length of the record payload + * + * @return Operation status + */ + c_string DL_API ParseNdefMessage(IN uint8_t *type_record, uint8_t type_len, IN uint8_t *payload, uint32_t payload_len); + + // NT4H + + /** + * @brief Multi reader support. Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parametersM(UFR_HANDLE hndUFR, uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function returns file settings. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext); + + /** + * @brief Multi reader support. Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_ridM(UFR_HANDLE hndUFR, uint8_t aes_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uidM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_keyM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctrM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. No authentication + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_authM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signatureM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_statusM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_authM(UFR_HANDLE hndUFR, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_ttM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_fileM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief Multi reader support. Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint16_t duration); + + /** + * @brief Multi reader support. Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPasswordM(UFR_HANDLE hndUFR, uint8_t *old_password, uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM of uFR Online. Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWriteM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size, uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromReadM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into uFR Online RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *password, uint8_t *time); + + /** + * @brief Multi reader support. Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOStateM(UFR_HANDLE hndUFR, uint8_t pin, uint8_t state); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOStateM(UFR_HANDLE hndUFR, uint8_t *state); + + /** + * @brief Multi reader support. Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReaderM(UFR_HANDLE hndUFR, uint8_t reader); + + /** + * @brief Multi reader support. Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumberM(UFR_HANDLE hndUFR, uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersionM(UFR_HANDLE hndUFR, OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Multi reader support. Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOffM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableOnWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Function sets service data into eeprom. Only use with production firmware. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param hndUFR handle of the uFR device + * @param data pointer to array of 5 bytes which contains new service data + * @return Operation status + */ + UFR_STATUS DL_API SetServiceDataM(UFR_HANDLE hndUFR, IN uint8_t *data); + + /** + * @brief Function gets service data from eeprom. Use in diagnostic tool. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param hndUFR handle of the uFR device + * @param data pointer to array which contains service data + * @return Operation status + */ + UFR_STATUS DL_API GetServiceDataM(UFR_HANDLE hndUFR, OUT uint8_t *data); + + /** + * @brief Function gets number and types of the installed I2C devices at the reader + * @since uFCoder library version 6.0.18 + * + * @ingroup INTERNAL + * @param dev_num number of I2C devices found + * @param dev_bits bit array that represents types of I2C devices + * @return Operation status + */ + UFR_STATUS DL_API GetI2cDevicesStatusM(UFR_HANDLE hndUFR, uint8_t *dev_num, uint32_t *dev_bits); + + /** + * @brief Function gets lock status of the reader + * @since uFCoder library version 6.0.19 + * + * @ingroup INTERNAL + * @param lock_status + * @return Operation status + */ + UFR_STATUS DL_API GetReaderLockStatusM(UFR_HANDLE hndUFR, uint8_t *lock_status); + + /** + * @brief Function changes password at the NXP ICODE cards (provided passwords) + * @since uFCoder library version 6.0.13 + * + * @ingrup + * @param pwd_ident - Password Identifier + * @param current_password - pointer to the 4 bytes array that represents current password + * @param new_password - pointer to the 4 bytes array that represents new password + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password_PK_M(UFR_HANDLE hndUFR, uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); + + /** + * @brief Function changes password at the NXP ICODE cards (reader's passwords) + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param pwd_ident - Password Identifier + * @param current_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @param new_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @return Operation status + */ + UFR_STATUS DL_API icode_write_passwordM(UFR_HANDLE hndUFR, uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page_PK_M(UFR_HANDLE hndUFR, IN uint8_t *read_password, IN uint8_t *write_password, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_pageM(UFR_HANDLE hndUFR, uint8_t read_pass_index, uint8_t write_pass_index, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function locks permanently the requested block on the ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API iso15693_lock_block_no_authM(UFR_HANDLE hndUFR, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block_PK_M(UFR_HANDLE hndUFR, IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_blockM(UFR_HANDLE hndUFR, uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); + + /** + * @brief Function read the security status of the blocks from ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param first_block - address of the first block for security status reading + * @param number_of_blocks - number of blocks for security status reading + * @param block_data - pointer to the array of blocks security status (1 - block locked, 0 - block not locked). + * @return Operation status + */ + UFR_STATUS DL_API iso15693_get_multiply_block_security_statusM(UFR_HANDLE hndUFR, uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + + + /** + * @brief Multi reader support. As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + + + UFR_STATUS DL_API COMTransceiveM(UFR_HANDLE hndUFR, IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General + * + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + UFR_STATUS DL_API COMTransceive(IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + // DLL version ---------------------------------------------------------------- + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + uint32_t DL_API GetDllVersion(void); + + /* + * Get "exploded" dll version example: + * + * #include + * #include + * + * void main(int argc, char *argv[]) + * { + * uint32_t dwDllVersion = 0; + * uint32_t dwDllMajorVersion = 0; + * uint32_t dwDllMinorVersion = 0; + * uint32_t dwDllBuild = 0; + * + * dwDllVersion = GetDllVersion(); + * + * // "explode" the dll version: + * dwDllMajorVersion = (DWORD)(LOBYTE(LOWORD(dwDllVersion))); + * dwDllMinorVersion = (DWORD)(HIBYTE(LOWORD(dwDllVersion))); + * + * // Get the dll build number. + * dwDllBuild = (DWORD)(HIWORD(dwDllVersion)); + * + * printf("Dll version is %ld.%ld (%ld)\n", dwDllMajorVersion, + * dwDllMinorVersion, + * dwDllBuild); + * } + * + */ + // Originality Check (performs the check is the chip on the card/tag NXP genuine): + /** + * @brief This function depends on OpenSSL crypto library. Since OpenSSL crypto library is dynamically linked during execution, the only prerequisite for a successful call to this function is that the libeay32.dll is in the current folder (valid for Windows) and / or libcrypto.so is in the environment path (e.g. LD_LIBRARY_PATH on Linux / macOS). OriginalityCheck() performs the check if the chip on the card / tag is NXP genuine. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param signature ECCSignature acquired by call to the ReadECCSignature() function. + * @param uid Card UID. Best if the card UID is acquired by previous call to the ReadECCSignature() function. + * @param uid_len Card UID length. Best if the card UID length is acquired by previous call to the ReadECCSignature() function. + * @param DlogicCardType Card type. Best if the DlogicCardType is acquired by previous call to the ReadECCSignature() function. + * + * @return Operation status + */ + UFR_STATUS DL_API OriginalityCheck(IN const uint8_t *signature, IN const uint8_t *uid, uint8_t uid_len, uint8_t DlogicCardType); + // Returns: + // UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND in case there is no OpenSSL library (libeay32.dll) in current folder or path + // UFR_OPEN_SSL_DYNAMIC_LIB_FAILED in case of OpenSSL library error (e.g. wrong OpenSSL version) + // UFR_NOT_NXP_GENUINE if chip on the card/tag is NOT NXP genuine + // UFR_OK is chip on the card/tag is NXP GENUINE + + //// debug functions: + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + c_string DL_API GetDllVersionStr(void); + + /** + * @brief Returns UFR_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param status UFR_STATUS status variable + * + * @return Operation status + */ + c_string DL_API UFR_Status2String(const UFR_STATUS status); + + /** + * @brief Returns UFR_SESSION_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param session_status UFR_SESSION_STATUS status variable + * + * @return c_string value of the status code + */ + c_string DL_API UFR_SessionStatus2String(const UFR_SESSION_STATUS session_status); + + /** + * @brief Returns card type as a c_string instead of byte value + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param dl_type_code card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + c_string DL_API UFR_DLCardType2String(uint8_t dl_type_code); + +//// Helper functions: +#ifndef _WIN32 + + unsigned long GetTickCount(void); + +#endif // #ifndef _WIN32 + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information + * + * @return The reader's descriptive name + */ + c_string DL_API GetReaderDescription(void); + + /** + * @brief Multi reader support. This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * + * @return Returns the reader's descriptive name. + */ + c_string DL_API GetReaderDescriptionM(UFR_HANDLE hndUFR); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// #ifdef _WIN32 || __linux__ + +// #else +// #endif // _WIN32 + + + +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#ifdef __ANDROID__ +#include + + extern JNIEnv *global_env; + extern jclass global_class; + extern jclass usb_global_class; + + /** + + * + * @param env + * @param class1 + * + * @return Operation status + */ + void DL_API initVM(JNIEnv *env, jclass class1); +#endif + + + +#ifdef __APPLE__ +#include +#if TARGET_OS_IPHONE + typedef void (*CardDetectedCallback)(void *_Nonnull context, const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(void *_Nonnull context); + typedef void (*SessionErrorCallback)(void *_Nonnull context, UFR_SESSION_STATUS error_code, const char *error_description); + /** + * @brief For iOS only: This function is used to set message displayed when the NFC Session window is started
+ * E.g 'Read the tag with the phone' + * NFC Session can be started via ReaderOpenEx() and appropriate parameters, or openNFCSession() + * @since uFCoder library version 6.0.0 + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + void setNFCMessage(const char *message); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * @param context pointer to UIView that bridges Swift with native code. e.g `let ble_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(void *_Nonnull context, const char *reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + void DL_API closeBLESession(void); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param context pointer to UIView that bridges Swift with native code. e.g `let nfc_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(void *_Nonnull context, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char *license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); +#else + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); + +#endif // TARGET_OS_IPHONE +#endif // __APPLE__ + +#ifdef __ANDROID__ + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param reader_sn uFR Online reader serial number (e.g ONXXXXXX) + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param session_error_callback TEST + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(const char *reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openBLESession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeBLESession(void); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char *license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); +#endif // __ANDROID__ + +#if defined(_WIN32) || defined(__linux__) + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + /** + * @brief This function is used to enable asynchronous event-driven API callbacks.
+ * Prerequisites: ReaderOpen() or ReaderOpenEx() must be called first and must return `UFR_OK` status to open connection with the reader
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by StartAsyncSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + UFR_STATUS DL_API StopAsyncSession(); + +#endif // _WIN32 || __linux__ + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardDetectedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardDetectedCallback(CardDetectedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardRemovedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardRemovedCallback(CardRemovedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'SessionErrorCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setSessionErrorCallback(SessionErrorCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* uFCoder_H_ */ diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/libuFCoder-ios-static.a b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/libuFCoder-ios-static.a new file mode 100644 index 0000000..bd033b6 Binary files /dev/null and b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64/libuFCoder-ios-static.a differ diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap new file mode 100644 index 0000000..ff3803f --- /dev/null +++ b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap @@ -0,0 +1,5 @@ +module uFCoder { + header "uFCoder.h" + + export * +} diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/Headers/uFCoder.h b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/Headers/uFCoder.h new file mode 100644 index 0000000..361b60f --- /dev/null +++ b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/Headers/uFCoder.h @@ -0,0 +1,49871 @@ +/* + * uFCoder.h + * + * library version: 6.0.21 + * + * Created on: 2009-01-14 + * Last edited: 2025-06-18 + * + * Author: D-Logic + */ +#ifndef uFCoder_H_ +#define uFCoder_H_ + +#include +#include +#include + +#define IN // array that you pass to function +#define OUT // array that you receive from function +#define VAR // first element of array that you receive from function (single variable) + +//////////////////////////////////////////////////////////////////// +/** + * Type for representing null terminated char array ( aka C-String ) + * Array is always one byte longer ( for null character ) then string + * Memory space for array must be allocated before use. + */ +typedef const char *c_string; +//////////////////////////////////////////////////////////////////// + +#ifdef _WIN32 +// WINDOWS +#if defined(DL_CREATE_STATIC_LIB) || defined(DL_USE_STATIC_LIB) +#define DL_API +#else +#ifndef DL_uFC_EXPORTS +#ifdef _WIN_IOT +#define DL_API __declspec(dllimport) // Win IoT +#else +#define DL_API /*__declspec(dllimport) */ __stdcall // STDCALL - GCC - .NET +#endif // _WIN_IOT +#else +#define DL_API __declspec(dllexport) __stdcall +#endif // DL_uFC_EXPORTS +#endif // DL_CREATE_STATIC_LIB +#else +// Linux & MAC OS +#define DL_API +#endif // _WIN32 + +#if defined(DL_uFC_EXPORTS) || defined(DL_CREATE_STATIC_LIB) || defined(__ANDROID__) || defined(ESP_PLATFORM) || defined(IOS_PLATFORM) +typedef struct S_UFR_HANDLE *UFR_HANDLE; +#else +typedef void *UFR_HANDLE; +#endif + +// MIFARE CLASSIC type id's: +#define MIFARE_CLASSIC_1k 0x08 +#define MF1ICS50 0x08 +#define SLE66R35 0x88 // Infineon = Mifare Classic 1k +#define MIFARE_CLASSIC_4k 0x18 +#define MF1ICS70 0x18 +#define MIFARE_CLASSIC_MINI 0x09 +#define MF1ICS20 0x09 + +// DLOGIC CARD TYPE +#define TAG_UNKNOWN 0 +#define DL_MIFARE_ULTRALIGHT 0x01 +#define DL_MIFARE_ULTRALIGHT_EV1_11 0x02 +#define DL_MIFARE_ULTRALIGHT_EV1_21 0x03 +#define DL_MIFARE_ULTRALIGHT_C 0x04 +#define DL_NTAG_203 0x05 +#define DL_NTAG_210 0x06 +#define DL_NTAG_212 0x07 +#define DL_NTAG_213 0x08 +#define DL_NTAG_215 0x09 +#define DL_NTAG_216 0x0A +#define DL_MIKRON_MIK640D 0x0B +#define NFC_T2T_GENERIC 0x0C +#define DL_NT3H_1101 0x0D +#define DL_NT3H_1201 0x0E +#define DL_NT3H_2111 0x0F +#define DL_NT3H_2211 0x10 +#define DL_NTAG_413_DNA 0x11 +#define DL_NTAG_424_DNA 0x12 +#define DL_NTAG_424_DNA_TT 0x13 +#define DL_NTAG_210U 0x14 +#define DL_NTAG_213_TT 0x15 + +#define DL_MIFARE_CLASSIC_2K 0x19 +#define DL_MIFARE_MINI 0x20 +#define DL_MIFARE_CLASSIC_1K 0x21 +#define DL_MIFARE_CLASSIC_4K 0x22 +#define DL_MIFARE_PLUS_S_2K_SL0 0x23 +#define DL_MIFARE_PLUS_S_4K_SL0 0x24 +#define DL_MIFARE_PLUS_X_2K_SL0 0x25 +#define DL_MIFARE_PLUS_X_4K_SL0 0x26 +#define DL_MIFARE_DESFIRE 0x27 +#define DL_MIFARE_DESFIRE_EV1_2K 0x28 +#define DL_MIFARE_DESFIRE_EV1_4K 0x29 +#define DL_MIFARE_DESFIRE_EV1_8K 0x2A +#define DL_MIFARE_DESFIRE_EV2_2K 0x2B +#define DL_MIFARE_DESFIRE_EV2_4K 0x2C +#define DL_MIFARE_DESFIRE_EV2_8K 0x2D +#define DL_MIFARE_PLUS_S_2K_SL1 0x2E +#define DL_MIFARE_PLUS_X_2K_SL1 0x2F +#define DL_MIFARE_PLUS_EV1_2K_SL1 0x30 +#define DL_MIFARE_PLUS_X_2K_SL2 0x31 +#define DL_MIFARE_PLUS_S_2K_SL3 0x32 +#define DL_MIFARE_PLUS_X_2K_SL3 0x33 +#define DL_MIFARE_PLUS_EV1_2K_SL3 0x34 +#define DL_MIFARE_PLUS_S_4K_SL1 0x35 +#define DL_MIFARE_PLUS_X_4K_SL1 0x36 +#define DL_MIFARE_PLUS_EV1_4K_SL1 0x37 +#define DL_MIFARE_PLUS_X_4K_SL2 0x38 +#define DL_MIFARE_PLUS_S_4K_SL3 0x39 +#define DL_MIFARE_PLUS_X_4K_SL3 0x3A +#define DL_MIFARE_PLUS_EV1_4K_SL3 0x3B +#define DL_MIFARE_PLUS_SE_SL0 0x3C +#define DL_MIFARE_PLUS_SE_SL1 0x3D +#define DL_MIFARE_PLUS_SE_SL3 0x3E +#define DL_MIFARE_DESFIRE_LIGHT 0x3F + +#define DL_UNKNOWN_ISO_14443_4 0x40 +#define DL_GENERIC_ISO14443_4 0x40 +#define DL_GENERIC_ISO14443_4_TYPE_B 0x41 +#define DL_GENERIC_ISO14443_3_TYPE_B 0x42 +#define DL_MIFARE_PLUS_EV1_2K_SL0 0x43 +#define DL_MIFARE_PLUS_EV1_4K_SL0 0x44 +#define DL_MIFARE_DESFIRE_EV3_2K 0x45 +#define DL_MIFARE_DESFIRE_EV3_4K 0x46 +#define DL_MIFARE_DESFIRE_EV3_8K 0x47 + +// ISO15693 cards +#define DL_GENERIC_ISO15693 0x50 +#define DL_ICODE_SLIX 0x51 +#define DL_ICODE_SLIX_S 0x52 +#define DL_ICODE_SLIX_L 0x53 +#define DL_ICODE_SLIX_2 0x54 +#define DL_ICODE_DNA 0x55 +#define DL_ICODE_3 0x56 + +#define DL_MOBILE_AID 0x60 +#define DL_APPLE_VAS_V1 0x6A +#define DL_APPLE_VAS_V2 0x6B +#define DL_IMEI_UID 0x80 + +// ST Product ID-s: +#define M24SR02 0x82 +#define M24SR02_AUTOMOTIVE 0x8A +#define M24SR04 0x86 +#define M24SR04_AUTOMOTIVE 0x8E +#define M24SR16 0x85 +#define M24SR16_AUTOMOTIVE 0x8D +#define M24SR64 0x84 +#define M24SR64_AUTOMOTIVE 0x8C + +// DLJavaCardTypes: +#define DLSigner81 0xA0 +#define DLSigner22 0xA1 +#define DLSigner30 0xA2 +#define DLSigner10 0xA3 +#define DLSigner145 0xAA + +enum E_CARD_IN_SAM_SLOT +{ + SAM_SLOT_MIFARE_SAM_AV2 = 1, + SAM_SLOT_GENERIC = 4 +}; + +// DLJavaCardSignerAlgorithmTypes: +enum E_SIGNER_CIPHERS +{ + SIG_CIPHER_RSA = 0, + SIG_CIPHER_ECDSA, + + SIG_CIPHER_MAX_SUPPORTED +}; + +enum E_SIGNER_RSA_PADDINGS +{ + PAD_NULL = 0, + PAD_PKCS1_V1_5, + PAD_PKCS1_PSS, + + SIG_PAD_MAX_SUPPORTED +}; +#define PAD_PKCS1 PAD_PKCS1_V1_5 + +enum E_SIGNER_DIGESTS +{ + ALG_NULL = 0, + ALG_SHA, + ALG_SHA_256, + ALG_SHA_384, + ALG_SHA_512, + ALG_SHA_224, + ALG_SHA_512_224, + ALG_SHA_512_256, + + SIG_DIGEST_MAX_SUPPORTED +}; + +enum E_KEY_TYPES +{ + TYPE_RSA_PRIVATE = 0, + TYPE_RSA_CRT_PRIVATE, + TYPE_EC_F2M_PRIVATE, + TYPE_EC_FP_PRIVATE +}; + +enum E_OBJ_TYPES +{ + OBJ_TYPE_RSA_CERT = 0, + OBJ_TYPE_EC_CERT, + OBJ_TYPE_CA_CERT, + + OBJ_TYPES_COUNT +}; + +// JCDL_AIDs +#define DL_RAW_SIZEOF_SZ(x) (sizeof(x) - 1) +#define DL_AID_RID_PLUS "\xF0" "DLogic" +#define DL_SIGNER_PIX "\x00\x01" +#define DL_STORAGE_PIX "\x01\x01" +#define DL_SIGNER_AID DL_AID_RID_PLUS DL_SIGNER_PIX +#define DL_SIGNER_AID_SIZE 9 +#define DL_STORAGE_AID DL_AID_RID_PLUS DL_STORAGE_PIX +#define DL_STORAGE_AID_SIZE 9 + +// Universal JCDL instructions: +#define INS_LOGIN 0x20 +#define INS_GET_PIN_TRIES_REMAINING 0x21 +#define INS_PIN_CHANGE 0x22 +#define INS_PIN_UNBLOCK 0x23 + +// JCDLStorage instructions: +#define INS_PIN_ENABLE 0x24 +#define INS_PIN_DISABLE 0x25 +#define INS_LIST_FILES 0x31 +#define INS_GET_FILE_SIZE 0x32 +#define INS_READ_FILE 0x33 +#define INS_WRITE_FILE 0x34 +#define INS_DELETE_FILE 0x3F + +// JCDLSigner instructions: +#define INS_SET_RSA_PRIKEY 0x51 +#define INS_GEN_RSA_KEY_PAIR 0x52 +#define INS_GET_RSA_PUBKEY_MODULUS 0x53 +#define INS_GET_RSA_PUBKEY_EXPONENT 0x54 +#define INS_DEL_RSA_KEY_PAIR 0x5F +#define INS_SET_EC_PRIKEY 0x61 +#define INS_GEN_EC_KEY_PAIR 0x62 +#define INS_GET_EC_PUBKEY 0x63 +#define INS_GET_EC_FIELD 0x64 +#define INS_GET_EC_AB 0x65 +#define INS_GET_EC_G 0x66 +#define INS_GET_EC_RK_SIZE 0x67 +#define INS_DEL_EC_KEY_PAIR 0x6F +#define INS_GET_SIGNATURE 0x71 +#define INS_PUT_OBJ 0x31 +#define INS_PUT_OBJ_SUBJECT 0x32 +#define INS_INVALIDATE_CERT 0x33 +#define INS_GET_OBJ 0x41 +#define INS_GET_OBJ_ID 0x42 +#define INS_GET_OBJ_SUBJECT 0x43 + +// Universal JCDL constants: +#define PIN_MAX_TRIES 5 +#define PIN_MIN_LENGTH 4 +#define PIN_MAX_LENGTH 8 +#define PUK_MAX_TRIES 10 +#define PUK_LENGTH 8 + +// JCDLSigner constants: +#define JC_APP_MAX_KEY_INDEX ((3) - 1) +#define JC_APP_MAX_CA_CERT_INDEX ((12) - 1) +#define JC_APP_MAX_ID_SIZE 253 +#define JC_APP_MAX_SUBJECT_SIZE 255 +#define JC_APP_MAX_SIGNATURE_LEN 256 +#define JC_APP_MAX_PIN_LENGTH 8 + +// JCDLStorage constants: +#define JC_DL_STORAGE_MAX_FILES 16 +#define JC_DL_STORAGE_MAX_FILE_SIZE (32 * 1024 - 2) // 32KB - 2 byte system reserved + +// MIFARE CLASSIC Authentication Modes: +enum MIFARE_AUTHENTICATION +{ + MIFARE_AUTHENT1A = 0x60, + MIFARE_AUTHENT1B = 0x61, +}; + +// MIFARE PLUS AES Authentication Modes: +enum MIFARE_PLUS_AES_AUTHENTICATION +{ + MIFARE_PLUS_AES_AUTHENT1A = 0x80, + MIFARE_PLUS_AES_AUTHENT1B = 0x81, +}; + +enum MIFARE_PLUS_AES_KEY_TYPE +{ + MIFARE_PLUS_AES_KEY_A = 1, + MIFARE_PLUS_AES_KEY_B = 2, +}; + +// T2T authentication constants: +enum T2T_AUTHENTICATION +{ + T2T_NO_PWD_AUTH = 0, + T2T_RKA_PWD_AUTH = 1, + T2T_PK_PWD_AUTH = 3, + T2T_WITHOUT_PWD_AUTH = 0x60, + T2T_WITH_PWD_AUTH = 0x61, +}; + +// T4T authentication constants +enum T4T_AUTHENTICATION +{ + T4T_WITHOUT_PWD_AUTH = 0x60, + T4T_PK_PWD_AUTH = 0x80, + T4T_RKA_PWD_AUTH = 0x02, +}; + +enum ADDRESS_MODE +{ + ADDRESS_MODE_BLOCK = 0, + ADDRESS_MODE_SECTOR, +}; + +#define MAX_UID_LEN 10 +#define MAX_ATS_LEN 25 +#define ECC_SIG_LEN 32 + +// API Status Codes Type: +typedef enum UFCODER_ERROR_CODES +{ + UFR_OK = 0x00, + UFR_COMMUNICATION_ERROR = 0x01, + UFR_CHKSUM_ERROR = 0x02, + UFR_READING_ERROR = 0x03, + UFR_WRITING_ERROR = 0x04, + UFR_BUFFER_OVERFLOW = 0x05, + UFR_MAX_ADDRESS_EXCEEDED = 0x06, + UFR_MAX_KEY_INDEX_EXCEEDED = 0x07, + UFR_NO_CARD = 0x08, + UFR_COMMAND_NOT_SUPPORTED = 0x09, + UFR_FORBIDEN_DIRECT_WRITE_IN_SECTOR_TRAILER = 0x0A, + UFR_ADDRESSED_BLOCK_IS_NOT_SECTOR_TRAILER = 0x0B, + UFR_WRONG_ADDRESS_MODE = 0x0C, + UFR_WRONG_ACCESS_BITS_VALUES = 0x0D, + UFR_AUTH_ERROR = 0x0E, + UFR_PARAMETERS_ERROR = 0x0F, + UFR_MAX_SIZE_EXCEEDED = 0x10, + UFR_UNSUPPORTED_CARD_TYPE = 0x11, + + UFR_COMMUNICATION_BREAK = 0x50, + UFR_NO_MEMORY_ERROR = 0x51, + UFR_CAN_NOT_OPEN_READER = 0x52, + UFR_READER_NOT_SUPPORTED = 0x53, + UFR_READER_OPENING_ERROR = 0x54, + UFR_READER_PORT_NOT_OPENED = 0x55, + UFR_CANT_CLOSE_READER_PORT = 0x56, + UFR_BLE_INVALID_PAIRING = 0x57, + + UFR_I2C_BUS_ERROR = 0x6A, + UFR_ECC_STORAGE_ERROR = 0x6B, + + UFR_WRITE_VERIFICATION_ERROR = 0x70, + UFR_BUFFER_SIZE_EXCEEDED = 0x71, + UFR_VALUE_BLOCK_INVALID = 0x72, + UFR_VALUE_BLOCK_ADDR_INVALID = 0x73, + UFR_VALUE_BLOCK_MANIPULATION_ERROR = 0x74, + UFR_WRONG_UI_MODE = 0x75, + UFR_KEYS_LOCKED = 0x76, + UFR_KEYS_UNLOCKED = 0x77, + UFR_WRONG_PASSWORD = 0x78, + UFR_CAN_NOT_LOCK_DEVICE = 0x79, + UFR_CAN_NOT_UNLOCK_DEVICE = 0x7A, + UFR_DEVICE_EEPROM_BUSY = 0x7B, + UFR_RTC_SET_ERROR = 0x7C, + + ANTI_COLLISION_DISABLED = 0x7D, + NO_TAGS_ENUMERRATED = 0x7E, + CARD_ALREADY_SELECTED = 0x7F, + + // NDEF error codes + UFR_WRONG_NDEF_CARD_FORMAT = 0x80, + UFR_NDEF_MESSAGE_NOT_FOUND = 0x81, + UFR_NDEF_UNSUPPORTED_CARD_TYPE = 0x82, + UFR_NDEF_CARD_FORMAT_ERROR = 0x83, + UFR_MAD_NOT_ENABLED = 0x84, + UFR_MAD_VERSION_NOT_SUPPORTED = 0x85, + UFR_NDEF_MESSAGE_NOT_COMPATIBLE = 0x86, + + // Tag emulation mode errors: + FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90, + + // FTDI errors: + UFR_FT_STATUS_ERROR_1 = 0xA0, + UFR_FT_STATUS_ERROR_2 = 0xA1, + UFR_FT_STATUS_ERROR_3 = 0xA2, + UFR_FT_STATUS_ERROR_4 = 0xA3, + UFR_FT_STATUS_ERROR_5 = 0xA4, + UFR_FT_STATUS_ERROR_6 = 0xA5, + UFR_FT_STATUS_ERROR_7 = 0xA6, + UFR_FT_STATUS_ERROR_8 = 0xA7, + UFR_FT_STATUS_ERROR_9 = 0xA8, + + // MIFARE PLUS error codes + UFR_MFP_COMMAND_OVERFLOW = 0xB0, + UFR_MFP_INVALID_MAC = 0xB1, + UFR_MFP_INVALID_BLOCK_NR = 0xB2, + UFR_MFP_NOT_EXIST_BLOCK_NR = 0xB3, + UFR_MFP_COND_OF_USE_ERROR = 0xB4, + UFR_MFP_LENGTH_ERROR = 0xB5, + UFR_MFP_GENERAL_MANIP_ERROR = 0xB6, + UFR_MFP_SWITCH_TO_ISO14443_4_ERROR = 0xB7, + UFR_MFP_ILLEGAL_STATUS_CODE = 0xB8, + UFR_MFP_MULTI_BLOCKS_READ = 0xB9, + + // NT4H error codes + NT4H_COMMAND_ABORTED = 0xC0, + NT4H_LENGTH_ERROR = 0xC1, + NT4H_PARAMETER_ERROR = 0xC2, + NT4H_NO_SUCH_KEY = 0xC3, + NT4H_PERMISSION_DENIED = 0xC4, + NT4H_AUTHENTICATION_DELAY = 0xC5, + NT4H_MEMORY_ERROR = 0xC6, + NT4H_INTEGRITY_ERROR = 0xC7, + NT4H_FILE_NOT_FOUND = 0xC8, + NT4H_BOUNDARY_ERROR = 0xC9, + NT4H_INVALID_MAC = 0xCA, + NT4H_NO_CHANGES = 0xCB, + + // multiple units - return from the functions with ReaderList_ prefix in name + UFR_DEVICE_WRONG_HANDLE = 0x100, + UFR_DEVICE_INDEX_OUT_OF_BOUND, + UFR_DEVICE_ALREADY_OPENED, + UFR_DEVICE_ALREADY_CLOSED, + UFR_DEVICE_IS_NOT_CONNECTED, + + // Originality Check Error Codes: + UFR_NOT_NXP_GENUINE = 0x200, + UFR_OPEN_SSL_DYNAMIC_LIB_FAILED, + UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND, + + // DESFIRE Card Status Error Codes: + READER_ERROR = 0xBB7, // 2999 [dec] + NO_CARD_DETECTED = 0xBB8, // 3000 [dec] + CARD_OPERATION_OK = 0xBB9, // 3001 [dec] + WRONG_KEY_TYPE = 0xBBA, // 3002 [dec] + KEY_AUTH_ERROR = 0xBBB, // 3003 [dec] + CARD_CRYPTO_ERROR = 0xBBC, // 3004 [dec] + READER_CARD_COMM_ERROR = 0xBBD, // 3005 [dec] + PC_READER_COMM_ERROR = 0xBBE, // 3006 [dec] + COMMIT_TRANSACTION_NO_REPLY = 0xBBF, // 3007 [dec] + COMMIT_TRANSACTION_ERROR = 0xBC0, // 3008 [dec] + NOT_SUPPORTED_KEY_TYPE = 0xBC2, // 3010 [dec] + WRONG_FILE_TYPE = 0xBC3, // 3011 [dec] + + DESFIRE_CARD_NO_CHANGES = 0x0C0C, + DESFIRE_CARD_OUT_OF_EEPROM_ERROR = 0x0C0E, + DESFIRE_CARD_ILLEGAL_COMMAND_CODE = 0x0C1C, + DESFIRE_CARD_INTEGRITY_ERROR = 0x0C1E, + DESFIRE_CARD_NO_SUCH_KEY = 0x0C40, + DESFIRE_CARD_LENGTH_ERROR = 0x0C7E, + DESFIRE_CARD_PERMISSION_DENIED = 0x0C9D, + DESFIRE_CARD_PARAMETER_ERROR = 0x0C9E, + DESFIRE_CARD_APPLICATION_NOT_FOUND = 0x0CA0, + DESFIRE_CARD_APPL_INTEGRITY_ERROR = 0x0CA1, + DESFIRE_CARD_AUTHENTICATION_ERROR = 0x0CAE, + DESFIRE_CARD_ADDITIONAL_FRAME = 0x0CAF, + DESFIRE_CARD_BOUNDARY_ERROR = 0x0CBE, + DESFIRE_CARD_PICC_INTEGRITY_ERROR = 0x0CC1, + DESFIRE_CARD_COMMAND_ABORTED = 0x0CCA, + DESFIRE_CARD_PICC_DISABLED_ERROR = 0x0CCD, + DESFIRE_CARD_COUNT_ERROR = 0x0CCE, + DESFIRE_CARD_DUPLICATE_ERROR = 0x0CDE, + DESFIRE_CARD_EEPROM_ERROR_DES = 0x0CEE, + DESFIRE_CARD_FILE_NOT_FOUND = 0x0CF0, + DESFIRE_CARD_FILE_INTEGRITY_ERROR = 0x0CF1, + DESFIRE_CATD_AUTHENTICATION_DELAY = 0X0CAD, + + // uFCoder library errors: + UFR_NOT_IMPLEMENTED = 0x1000, + UFR_COMMAND_FAILED = 0x1001, + UFR_TIMEOUT_ERR = 0x1002, + UFR_FILE_SYSTEM_ERROR = 0x1003, + UFR_FILE_SYSTEM_PATH_NOT_EXISTS = 0x1004, + UFR_FILE_NOT_EXISTS = 0x1005, + UFR_FTD2XX_DLL_NOT_FOUND = 0x1006, + + // uFCoder library/licensing specific + UFR_JSON_INVALID = 0x1012, + UFR_LICENSE_INVALID = 0x1013, + UFR_LICENSE_SAVE_FAILED = 0x1014, + UFR_LICENSE_NOT_FOUND = 0x1015, + UFR_LICENSE_HAS_EXPIRED = 0x1016, + + // SAM module error codes: + UFR_SAM_APDU_ERROR = 0x2000, + UFR_SAM_AUTH_ERROR, + UFR_SAM_CRYPTO_ERROR, + + // TLS, HTTPS Error Codes: + TLS_ERR_OPENING_SOCKET = 0x5000, + TLS_ERR_NO_SUCH_HOST = 0x5001, + TLS_CONNECTING_ERROR = 0x5002, + TLS_ERR_SERVER_UNEXPECTEDLY_CLOSED_CONNECTION = 0x5003, + TLS_ERR_UNKNOWN_GIDS_CERTIFICATE_FORMAT = 0x5004, + TLS_ERR_SET_PIN_FOR_GIDS_CERT_ONLY = 0x5005, + TLS_ERR_GIDS_PIN_CODE_WRONG = 0x5006, + TLS_ERR_UNSUPPORTED_CERTIFICATE_TYPE = 0x5007, + TLS_ERR_PRIVATE_KEY_CONTEXT_WRONG = 0x5008, + + // JC cards APDU Error Codes: + UFR_APDU_JC_APP_NOT_SELECTED = 0x6000, + UFR_APDU_TRANSCEIVE_ERROR = 0xAE, + UFR_APDU_JC_APP_BUFF_EMPTY = 0x6001, + UFR_APDU_WRONG_SELECT_RESPONSE = 0x6002, + UFR_APDU_WRONG_KEY_TYPE = 0x6003, + UFR_APDU_WRONG_KEY_SIZE = 0x6004, + UFR_APDU_WRONG_KEY_PARAMS = 0x6005, + UFR_APDU_WRONG_SIGNING_ALGORITHM = 0x6006, + UFR_APDU_PLAIN_TEXT_MAX_SIZE_EXCEEDED = 0x6007, + UFR_APDU_UNSUPPORTED_KEY_SIZE = 0x6008, + UFR_APDU_UNSUPPORTED_ALGORITHMS = 0x6009, + UFR_APDU_PKI_OBJECT_NOT_FOUND = 0x600A, + UFR_APDU_MAX_PIN_LENGTH_EXCEEDED = 0x600B, + UFR_DIGEST_LENGTH_DOES_NOT_MATCH = 0x600C, + + // reserved: 0x6100, + CRYPTO_SUBSYS_NOT_INITIALIZED = 0x6101, + CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR = 0x6102, + CRYPTO_SUBSYS_MAX_HASH_INPUT_EXCEEDED = 0x6103, + CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM = 0x6104, + CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM = 0x6105, + CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM = 0x6106, + CRYPTO_SUBSYS_WRONG_SIGNATURE = 0x6107, + CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH = 0x6108, + CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE = 0x6109, + CRYPTO_SUBSYS_HASHING_ERROR = 0x610A, + CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS = 0x610B, + CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY = 0x610C, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS = 0x610D, + CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY = 0x610E, + + UFR_WRONG_PEM_CERT_FORMAT = 0x61C0, + + // X.509 specific statuses: + X509_CAN_NOT_OPEN_FILE = 0x6200, + X509_WRONG_DATA = 0x6201, + X509_WRONG_LENGTH = 0x6202, + X509_UNSUPPORTED_PUBLIC_KEY_TYPE = 0x6203, + X509_UNSUPPORTED_PUBLIC_KEY_SIZE = 0x6204, + X509_UNSUPPORTED_PUBLIC_KEY_EXPONENT = 0x6205, + X509_EXTENSION_NOT_FOUND = 0x6206, + X509_WRONG_SIGNATURE = 0x6207, + X509_UNKNOWN_PUBLIC_KEY_TYPE = 0x6208, + X509_WRONG_RSA_PUBLIC_KEY_FORMAT = 0x6209, + X509_WRONG_ECC_PUBLIC_KEY_FORMAT = 0x620A, + X509_SIGNATURE_NOT_MATCH_CA_PUBLIC_KEY = 0x620B, + X509_UNSUPPORTED_SIGNATURE_SCH = 0x620C, + X509_UNSUPPORTED_ECC_CURVE = 0x620D, + + // PKCS#7 specific statuses: + PKCS7_WRONG_DATA = 0x6241, + PKCS7_UNSUPPORTED_SIGNATURE_SCHEME = 0x6242, + PKCS7_SIG_SCH_NOT_MATCH_CERT_KEY_TYPE = 0x6243, + + PKCS7_WRONG_SIGNATURE = 0x6247, + + // MRTD specific statuses: + MRTD_SECURE_CHANNEL_SESSION_FAILED = 0x6280, + MRTD_WRONG_SOD_DATA = 0x6281, + MRTD_WRONG_SOD_LENGTH = 0x6282, + MRTD_UNKNOWN_DIGEST_ALGORITHM = 0x6283, + MRTD_WARNING_DOES_NOT_CONTAINS_DS_CERT = 0x6284, + MRTD_DATA_GROUOP_INDEX_NOT_EXIST = 0x6285, + MRTD_EF_COM_WRONG_DATA = 0x6286, + MRTD_EF_DG_WRONG_DATA = 0x6287, + MRTD_EF_DG1_WRONG_LDS_VERSION_LENGTH = 0x6288, + MRTD_VERIFY_CSCA_NOT_EXIST = 0x6289, + MRTD_VERIFY_WRONG_DS_SIGNATURE = 0x628A, + MRTD_VERIFY_WRONG_CSCA_SIGNATURE = 0x628B, + MRTD_MRZ_CHECK_ERROR = 0x628C, + MRTD_SESSION_NOT_INITIALIZED = 0x628D, + + // ICAO Master List specific statuses: + ICAO_ML_WRONG_FORMAT = 0x6300, + ICAO_ML_CAN_NOT_OPEN_FILE = 0x6301, + ICAO_ML_CAN_NOT_READ_FILE = 0x6302, + ICAO_ML_CERTIFICATE_NOT_FOUND = 0x6303, + ICAO_ML_WRONG_SIGNATURE = 0x6307, + + // EMV specific statuses + SYS_ERR_OUT_OF_MEMORY = 0x7001, + EMV_ERR_WRONG_INPUT_DATA = 0x7002, + EMV_ERR_MAX_TAG_LEN_BYTES_EXCEEDED = 0x7004, + EMV_ERR_TAG_NOT_FOUND = 0x7005, + EMV_ERR_TAG_WRONG_SIZE = 0x7006, + EMV_ERR_TAG_WRONG_TYPE = 0x7007, + EMV_ERR_IN_CARD_READER = 0x7008, + EMV_ERR_READING_RECORD = 0x7009, + EMV_ERR_PDOL_IS_EMPTY = 0x7010, + EMV_ERR_LIST_FORMAT_NOT_FOUND = 0x7011, + EMV_ERR_AFL_NOT_FOUND = 0x7012, + EMV_ERR_AID_NOT_FOUND = 0x7013, + + // ISO7816-4 Errors (R-APDU) - 2 SW bytes returned by the card, prefixed with 0x000A: + UFR_APDU_SW_TAG = 0x000A0000, + UFR_APDU_SW_OPERATION_IS_FAILED = 0x000A6300, + UFR_APDU_SW_WRONG_PIN_4_TRIES_REMAINING = 0x000A63C4, + UFR_APDU_SW_WRONG_PIN_3_TRIES_REMAINING = 0x000A63C3, + UFR_APDU_SW_WRONG_PIN_2_TRIES_REMAINING = 0x000A63C2, + UFR_APDU_SW_WRONG_PIN_1_TRIES_REMAINING = 0x000A63C1, + UFR_APDU_SW_WRONG_PIN_0_TRIES_REMAINING = 0x000A63C0, + UFR_APDU_SW_WRONG_LENGTH = 0x000A6700, + UFR_APDU_SW_SECURITY_STATUS_NOT_SATISFIED = 0x000A6982, + UFR_APDU_SW_AUTHENTICATION_METHOD_BLOCKED = 0x000A6983, + UFR_APDU_SW_DATA_INVALID = 0x000A6984, + UFR_APDU_SW_CONDITIONS_NOT_SATISFIED = 0x000A6985, + UFR_APDU_SW_WRONG_DATA = 0x000A6A80, + UFR_APDU_SW_FILE_NOT_FOUND = 0x000A6A82, + UFR_APDU_SW_RECORD_NOT_FOUND = 0x000A6A83, + UFR_APDU_SW_DATA_NOT_FOUND = 0x000A6A88, + UFR_APDU_SW_ENTITY_ALREADY_EXISTS = 0x000A6A89, + UFR_APDU_SW_INS_NOT_SUPPORTED = 0x000A6D00, + UFR_APDU_SW_NO_PRECISE_DIAGNOSTIC = 0x000A6F00, + + MAX_UFR_STATUS = 0x7FFFFFFF, + + UFR_DISPLAY_IMAGE_LOAD_ERROR = 0x8001, + UFR_DISPLAY_IMAGE_DIMENSION_ERROR = 0x8002, + UFR_DISPLAY_IMAGE_UNSUPPORTED_CHANNELS = 0x8003, + UFR_DISPLAY_WRITE_CMD_ERROR = 0x8004, + UFR_DISPLAY_READ_ACK_ERROR = 0x8005, + UFR_DISPLAY_WRITE_CMDEXT_ERROR = 0x8006, + UFR_DISPLAY_READ_RESPONSE_ERROR = 0x8007, + UFR_DISPLAY_TEXT_COUNT_OVERFLOW = 0x8008, + UFR_DISPLAY_INDEX_OVERFLOW = 0x8009, + UFR_DISPLAY_WRONG_SIMBOL_NUMB = 0x8010, + UFR_DISPLAY_COMMAND_FAILED = 0x8011 + +} UFR_STATUS; + +typedef enum UFCODER_SESSION_CODES +{ + UFR_SESSION_UNKNOWN_ERROR = 0x00, + UFR_SESSION_CLOSED = 0x01, + UFR_SESSION_EXPIRED = 0x02, + UFR_SESSION_DEVICE_DISCONNECTED = 0x03, + UFR_SESSION_DEVICE_FAILED_TO_CONNECT = 0x04, + + // BLE specific error codes + UFR_BLE_SESSION_ERROR_INVALID_PARAMETERS = 0x11, + UFR_BLE_SESSION_ERROR_INVALID_HANDLE = 0x12, + UFR_BLE_SESSION_ERROR_NOT_CONNECTED = 0x13, + UFR_BLE_SESSION_ERROR_OUT_OF_SPACE = 0x14, + UFR_BLE_SESSION_ERROR_OPERATION_CANCELLED = 0x15, + UFR_BLE_SESSION_ERROR_CONNECTION_TIMEOUT = 0x16, + UFR_BLE_SESSION_ERROR_UUID_NOT_ALLOWED = 0x17, + UFR_BLE_SESSION_ERROR_ALREADY_ADVERTISING = 0x18, + UFR_BLE_SESSION_ERROR_CONNECTION_LIMIT_REACHED = 0x19, + UFR_BLE_SESSION_ERROR_UNKNOWN_DEVICE = 0x20, + UFR_BLE_SESSION_ERROR_OPERATION_NOT_SUPPORTED = 0x21, + UFR_BLE_SESSION_ERROR_PEER_REMOVED_PAIRING_INFORMATION = 0x22, + UFR_BLE_SESSION_ERROR_ENCRYPTION_TIMED_OUT = 0x23, + UFR_BLE_SESSION_ERROR_TOO_MANY_LE_PAIRED_DEVICES = 0x24, + + // NFC specific error codes + + // Sesssion errors + UFR_NFC_SESSION_ERROR_FIRST_NDEF_TAG_READ = 0x30, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TERMINATED_UNEXPECTEDLY = 0x31, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_TIMEOUT = 0x32, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_SYSTEM_IS_BUSY = 0x33, + UFR_NFC_SESSION_ERROR_SESSION_INVALIDATION_USER_CANCELED = 0x34, + + // NDEF errors + UFR_NFC_SESSION_ERROR_TAG_NOT_WRITABLE = 0x40, + UFR_NFC_SESSION_ERROR_TAG_SIZE_TOO_SMALL = 0x41, + UFR_NFC_SESSION_ERROR_TAG_UPDATE_FAILURE = 0x42, + UFR_NFC_SESSION_ERROR_ZERO_LENGTH_MESSAGE = 0x43, + + // Transceive errors + UFR_NFC_SESSION_ERROR_RETRY_EXCEEDED = 0x50, + UFR_NFC_SESSION_ERROR_TAG_CONNECTION_LOST = 0x51, + UFR_NFC_SESSION_ERROR_TAG_NOT_CONNECTED = 0x52, + UFR_NFC_SESSION_ERROR_TAG_RESPONSE_ERROR = 0x53, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_SESSION_INVALIDATED = 0x54, + UFR_NFC_SESSION_ERROR_TAG_TRANSCEIVE_PACKET_TOO_LONG = 0x55, + + UFR_NFC_SESSION_ERROR_TAG_COMMAND_CONFIGURATION_INVALID_PARAMETERS = 0x56, + + // Other + UFR_NFC_SESSION_ERROR_UNSUPPORTED_FEATURE = 0x61, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER = 0x62, + UFR_NFC_SESSION_ERROR_INVALID_PARAMETER_LENGTH = 0x63, + UFR_NFC_SESSION_ERROR_PARAMETER_OUT_OF_BOUNDS = 0x64, + UFR_NFC_SESSION_ERROR_RADIO_DISABLED = 0x65, + UFR_NFC_SESSION_ERROR_SECURITY_VIOLATION = 0x66, + +} UFR_SESSION_STATUS; + +// DESFIRE key settings values +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE 0x09 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE 0x0F +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x01 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x08 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE 0x0E +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x00 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE 0x06 + +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x00 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x01 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x02 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x03 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x04 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x05 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x06 +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_NOT_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x07 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WITH_AUTH 0x08 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WITH_AUTH 0x09 +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0A +#define DESFIRE_KEY_SET_CREATE_WITH_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0B +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTH_AUTH 0x0C +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTH_AUTH 0x0D +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_NOT_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0E +#define DESFIRE_KEY_SET_CREATE_WITHOUT_AUTH_SET_CHANGE_KEY_CHANGE_APP_IDS_WIDTHOUT_AUTH 0x0F + +enum E_ASYMMETRIC_KEY_TYPES +{ + RSA_PRIVATE_KEY = 0, + ECDSA_PRIVATE_KEY, + + ASYMMETRIC_KEY_TYPES_NUM +}; + +#define MAX_ECC_CURVE_NAME_LEN 30 + +enum E_ECC_CURVE_DEFINITION_TYPES +{ + ECC_CURVE_INDEX, + ECC_CURVE_NAME, + ECC_CURVE_DOMAIN_PARAMETERS, + + ECC_CURVE_DEFINITION_TYPES_NUM +}; + +enum E_SIGNATURE_SCHEMES +{ + SHA1_WITH_RSA, + SHA256_WITH_RSA, + SHA384_WITH_RSA, + SHA512_WITH_RSA, + SHA224_WITH_RSA, + SHA512_224_WITH_RSA, + SHA512_256_WITH_RSA, + + RSA_PSS, + + ECDSA_WITH_SHA1, + ECDSA_WITH_SHA256, + ECDSA_WITH_SHA384, + ECDSA_WITH_SHA512, + ECDSA_WITH_SHA224, + + SIGNATURE_SCHEMES_NUM // Don't change the order. NEVER! +}; +enum E_SIGNATURE_SCH_TYPES +{ + RSA_PKCS1, + RSA_PKCS1_PSS, + ECDSA, + + SIGNATURE_SCH_TYPES_NUM +}; +enum E_PUB_KEY_TYPES +{ + PUB_KEY_TYPE_RSA, + PUB_KEY_TYPE_ECDSA_NAMED_CURVE, + PUB_KEY_TYPE_ECDSA_DOMAIN_PARAMS, + + PUB_KEY_TYPES_NUM +}; + +enum E_BIT_ENCODINGS +{ + ENCODING_BIN, + ENCODING_HEX +}; + +enum E_CERTIFICATE_TYPES +{ + X509_PEM, + X509_DER, + X509_GIDS_NFC, + + E_CERTIFICATE_TYPES_NUM +}; + +enum E_ECC_CURVES +{ + secp112r1, + secp112r2, + secp128r1, + secp128r2, + secp160r1, + secp160r2, + secp160k1, + secp192r1, + prime192v2, + prime192v3, + secp192k1, + secp224r1, + secp224k1, + secp256r1, + secp256k1, + secp384r1, + secp521r1, + prime239v1, + prime239v2, + prime239v3, + brainpoolP160r1, + brainpoolP192r1, + brainpoolP224r1, + brainpoolP256r1, + brainpoolP320r1, + brainpoolP384r1, + brainpoolP512r1, + brainpoolP160t1, + brainpoolP192t1, + brainpoolP224t1, + brainpoolP256t1, + brainpoolP320t1, + brainpoolP384t1, + brainpoolP512t1, + + ECC_CURVES_NUM + + /* Not supported in uFCoder library yet: + sect113r1, + sect113r2, + sect131r1, + sect131r2, + sect163k1, + sect163r1, + sect163r2, + sect193r1, + sect193r2, + sect233k1, + sect233r1, + sect239k1, + sect283k1, + sect283r1, + sect409k1, + sect409r1, + sect571k1, + sect571r1 + */ +}; +// #define F2M_CURVES sect113r1 + +typedef struct +{ + uint8_t *serial; + uint8_t *subject; + uint8_t *issuer; + uint8_t *SKI; + uint8_t *AKI; + uint32_t serial_len; + uint32_t subject_len; + uint32_t issuer_len; + uint32_t SKI_len; + uint32_t AKI_len; +} icaoMlSearchCriteria_t; + +typedef struct +{ + uint32_t ecc_curve_field_type; + void *field_domain_params; // To be defined. For now only a named primary field curves are supported. +} ecc_curve_domain_params_t; + +typedef struct +{ + uint32_t ecc_curve_definition_type; // one of the E_ECC_CURVE_DEFINITION_TYPES + uint32_t ecc_curve_index; + char *ecc_curve_name; + ecc_curve_domain_params_t *ecc_curve_domain_params; +} ecc_key_param_t; + +enum E_MRTD_IMG_TYPE +{ + MRTD_IMG_JPEG = 0, + MRTD_IMG_JP2 = 1, + MRTD_IMG_JPEG2000 = 1, // Alias for the MRTD_IMG_JP2 + + MRTD_IMG_TYPE_UNKNOWN = 0xFFFFFFFF +}; + +typedef enum +{ + USER_PIN = 0, + SO_PIN, + USER_PUK, + SO_PUK +} dl_sec_code_t; + +enum E_PRINT_VERBOSE_LEVELS +{ + PRINT_NONE, + PRINT_ESSENTIALS, + PRINT_DETAILS, + PRINT_ALL_PLUS_STATUSES, +}; + +// SAM definition +typedef enum E_SAM_HW_VER +{ + SAM_UNKNOWN_TYPE, + SAM_T1AD2060_AV1_MODE, + SAM_T1AD2060_AV2_MODE, + SAM_T1AR1070_AV1_MODE, + SAM_T1AR1070_AV2_MODE +} SAM_HW_TYPE; + +// Reader status +typedef enum E_EMULATION_MODES +{ + TAG_EMU_DISABLED, + TAG_EMU_DEDICATED, + TAG_EMU_COMBINED, + TAG_EMU_AUTO_AD_HOC +} emul_modes_t; + +typedef enum E_EMULATION_STATES +{ + EMULATION_NONE, + EMULATION_IDLE, + EMULATION_AUTO_COLL, + EMULATION_ACTIVE, + EMULATION_HALT, + EMULATION_POWER_OFF +} emul_states_t; + +typedef enum E_PCD_MGR_STATES +{ + PCD_MGR_NO_RF_GENERATED, + PCD_MGR_14443A_POLLING, + PCD_MGR_14443A_SELECTED, + PCD_MGR_CE_DEDICATED, + PCD_MGR_CE_COMBO_START, + PCD_MGR_CE_COMBO, + PCD_MGR_CE_COMBO_IN_FIELD +} pcd_states_t; + +enum E_RGB_PORT_NAMES +{ + EXTERNAL_RGB_PORT, + INTERNAL_RGB_PORT +}; + +enum E_CUSTOM_UI_IDLE_MODES +{ + CUSTOM_UI_IDLE_MODE_NONE = 0, + CUSTOM_UI_IDLE_MODE_STATIC_LED, + CUSTOM_UI_IDLE_MODE_BLINKING_LED, + CUSTOM_UI_IDLE_MODES_NUMBER_INDICATOR +}; + +enum E_CUSTOM_UI_DETECTED_MODES +{ + CUSTOM_UI_DETECTED_MODE_NONE = 0, + CUSTOM_UI_DETECTED_MODE_STATIC_LED, + CUSTOM_UI_DETECTED_MODE_STATIC_LED_BEEP, + CUSTOM_UI_DETECTED_MODE_BEEP, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED, + CUSTOM_UI_DETECTED_MODE_BLINKING_LED_BEEP, + CUSTOM_UI_DETECTED_MODES_NUMBER_INDICATOR +}; + +enum E_ISO15693_PASSWORD_IDENTIFIERS +{ + PWD_READ = 0x01, + PWD_WRITE = 0x02, + PWD_PRIVACY = 0x04, + PWD_DESTROY = 0x08, + PWD_EAS_AFI = 0x10 +}; + +#ifdef __cplusplus +extern "C" +{ +#endif + + /** + * @defgroup INTERNAL !!!INTERNAL!!! uFR API calls (Not for public SDK use) (remove from final revision) + * @{ + */ + /** @} */ // end of defgroup INTERNAL + + /** + * @defgroup UNDOCUMENTED UNDOCUMENTED uFR API calls (remove from final revision) + * @brief Excluded from docs due to the nature of their usage + * @{ + */ + /**@}*/ // end of defgroup INTERNAL + + /** @defgroup LibLic Library licensing + * @brief Prerequisite API calls for facilitating use of uFR MDK (Mobile Development Kit) with Android/iOS devices (usage of mobile device internal NFC antenna) + * @{ + */ + /** @} */ // end of LibLic + + /** @defgroup SingleReader Single Reader + * @{ + */ + /** @defgroup ReaderAndLibrary Reader and library + ** @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication + + /** @defgroup ReaderAndLibrary_Information Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information + + /** @defgroup ReaderAndLibrary_EEPROM EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM + + /** @defgroup ReaderAndLibrary_Signalization Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization + + /** @defgroup ReaderAndLibrary_RGBSignalization RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL. + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl Display Control + * @since uFCoder library version 6.0.5 + * + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures + + /** @defgroup ReaderAndLibrary_uFROnlineCommands uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands + + /** @defgroup ReaderAndLibrary_BaseHDUFR uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR + + /** @defgroup ReaderAndLibrary_NXPSAM Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM + + /** @defgroup ReaderAndLibrary_HelperFunc Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc + + /**@}*/ // end of defgroup ReaderAndLibrary + + /** @defgroup Card_Tag Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockRead(), BlockWrite(), LinearRead(), LinearWrite() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF + + /** @defgroup Card_Tag_NTAG_2XX NTAG2XX (Type 2) specific commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG + + /** @defgroup Card_Tag_NT4H NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H + + /** @defgroup Card_Tag_Mifare_Desfire Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire + + /** @defgroup Card_Tag_Mifare_Desfire_Light Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Desfire_Light + + /** @defgroup Card_Tag_Mifare_Plus Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Plus + + /** @defgroup Card_Tag_Ultralight_C Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Ultralight_C + + /** @defgroup Card_Tag_JavaCardApplication Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication + + /** @defgroup Card_Tag_CardFeatures Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4 ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4 + + /** @defgroup Card_Tag_CardFeatures_ISO7816 ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816 + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification + + /** @defgroup Card_Tag_CardFeatures_MRTD Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD + + /** @defgroup Card_Tag_CardFeatures_TLS TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS + + /** @defgroup Card_Tag_CardFeatures_EMV Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV + + /** @defgroup Card_Tag_CardFeatures_AntiCollision Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode + + /**@}*/ // end of defgroup Card_Tag_CardFeatures + + /**@}*/ // end of defgroup Card_Tag + + /** @defgroup Miscellaneous Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous + + /**@}*/ // end of defgroup SingleReader + + /** @defgroup MultiReader MultiReader + * @{ + ** @defgroup ReaderAndLibrary_ReaderList Handling multiple readers + * @brief If you want to communicate and use multiple readers from an application, you have to follow the + * initial procedure for enumerating uFR compatible devices and getting their handles + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_ReaderList + + /** @defgroup ReaderAndLibrary_M Reader and library + * @brief Functions related to reader itself, to obtain some info or set certain device parameters. + * @{ + */ + /** @defgroup ReaderAndLibrary_Communication_M Communication with the reader + * @brief Functions related to establishing, closing and changing speed of communication with the reader and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Communication_M + + /** @defgroup ReaderAndLibrary_Information_M Information about the reader + * @brief Functions related to getting information about the reader, e.g serial number, hardware/fimware version, reader type and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Information_M + + /** @defgroup ReaderAndLibrary_EEPROM_M EEPROM manipulation + * @brief Functions related to reading/writing data in the reader EEPROM, e.g user data, keys and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_EEPROM_M + + /** @defgroup ReaderAndLibrary_Signalization_M Signalization (default) + * @brief Functions related to interacting with the basic reader signalization + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_Signalization_M + + /** @defgroup ReaderAndLibrary_RGBSignalization_M RGB Signalization + * @brief Functions related to RGB signalization on supported reader types. E.g uFR Zero series, uFR Classic CS, uFR Advance, uFR XL + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_RGBSignalization_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_M Specific firmware features for uFR Series NFC readers + * @brief uFR Series readers specific firmware features, advanced set of different functions such as RTC, Display control, Tag emulation (dedicated/combined/ad-hoc) and more + * @{ + */ + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M Real Time Clock (RTC) + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M Display Control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M Tag emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M Combined emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M Ad-Hoc emulation mode + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M Shared RAM + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M Asynchronous UID Sending + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M Sleep and Auto Sleep + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + + /** @defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M RF Analog register settings + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + + /**@}*/ // end of defgroup ReaderAndLibrary_uFRSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M Specific firmware features for uFR Zero Series NFC readers + * @brief uFR Zero Series readers specific firmware features + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + + /** @defgroup ReaderAndLibrary_uFROnlineCommands_M uFR Online Reader specific commands + * @brief Functions related to uFR Online series readers only, specifically targetting the embedded ESP32 MCU + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_uFROnlineCommands_M + + /** @defgroup ReaderAndLibrary_BaseHDUFR_M uFR library support for Base HD NFC readers + * @brief Functions related to toggling BaseHD reader relay and access control + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_BaseHDUFR_M + + /** @defgroup ReaderAndLibrary_NXPSAM_M Support for NXP SAM (Secure Application Module) + * @brief Functions related to interacting with the SAM (Secure Application Module), such as authentication, key entry and more + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_NXPSAM_M + + /** @defgroup ReaderAndLibrary_HelperFunc_M Helper library functions + * @{ + */ + /**@}*/ // end of defgroup ReaderAndLibrary_HelperFunc_M + + /**@}*/ // end of defgroup ReaderAndLibrary_M + + /** @defgroup Card_Tag_M Card/tag commands + ** @brief Functions used for card (or tag) data manipulation, such as obtaining some info, reading or writing data into card + * @{ + */ + /** @defgroup Card_Tag_General_M General purpose card related commands + ** @brief Functions for getting common card data, not specific to card type. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_General + + /** @defgroup Card_Tag_Mifare_M Mifare Classic specific commands + ** @brief Functions specific to Mifare Classic® family of cards (Classic 1K and 4K). All functions + * are dedicated for use with Mifare Classic® cards. However, some functions can be used + * with other card types, mostly in cases of direct addressing scheme. E.g BlockReadM(), BlockWriteM(), LinearReadM(), LinearWriteM() can be used also with the NTAG2XX tags. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare + + /** @defgroup Card_Tag_NDEF_M NDEF related commands + ** @brief Functions for reading and writing common NDEF messages and records into various NFC tags. + * Currently, only NFC Type 2 Tags are supported, while support for other NFC Tag types will be added in future upgrades. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NDEF_M + + /** @defgroup Card_Tag_NTAG_2XX_M NTAG2XX (Type 2) related commands + ** @brief Functions specific to NTAG® family chips such as NTAG 203, 210, 212, 213, 215, 216. Due to the different memory sizes of various NTAG chips, we implemented functions for handling NTAG chips as generic NFC Type 2 Tag. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NTAG_2XX_M + + /** @defgroup Card_Tag_NT4H_M NT4H (Type 4) specific commands + ** @brief Functions specific to NT4H (Type 4) chips (e.g NTAG424DNA, with TagTamper support) + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_NT4H_M + + /** @defgroup Card_Tag_Mifare_Desfire_M Mifare DESFire specific commands + ** @brief Functions specific to Mifare DESFire® cards. All uFR Series readers support DESfire set of commands in AES encryption mode according to manufacturer's recommendations. In addition to AES, support for DES/2K3DES/3K3DES included. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_M + + /** @defgroup Card_Tag_Mifare_Desfire_Light_M Mifare DESFire Light specific commands + ** @brief Functions specific to Mifare DESFire® Light cards. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_Mifare_Desfire_Light_M + + /** @defgroup Card_Tag_Mifare_Plus_M Mifare Plus specific commands + ** @brief Functions specific to Mifare Plus cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Mifare_Plus_M + + /** @defgroup Card_Tag_Ultralight_C_M Ultralight C specific commands + ** @brief Functions specific to Ultralight C cards. + * @{ + */ + /**@}*/ + // end of defgroup Card_Tag_Ultralight_C_M + + /** @defgroup Card_Tag_JavaCardApplication_M Java Card Application (JCApp) specific commands + ** @brief "Java Card" refers to a contactless or dual interface Java Cards. For now, we have supported two JCApps in our uFR Series NFC API. Those JCApps are DLSigner and DLStorage. + * @{ + */ + /** @defgroup Card_Tag_JavaCardApplication_Common_M Common JCApp PIN functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_Common_M + + /** @defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M PKI infrastructure and digital signature support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + + /** @defgroup Card_Tag_JavaCardApplication_DLStorage_M DLStorage JCApp support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_DLStorage_M + + /**@}*/ // end of defgroup Card_Tag_JavaCardApplication_M + + /** @defgroup Card_Tag_CardFeatures_M Support for specific card features + ** @brief This is a group for specific card features (Originality checking, MRTD, EMV etc...) + * @{ + */ + /** @defgroup Card_Tag_CardFeatures_OriginalityChecking_M Originality Checking + * @brief Some card chips supports originality checking mechanism using Elliptic Curve Digital Signature Algorithm (ECDSA). Chip families that support originality checking mechanism are NTAG 21x and Mifare Ultralight EV1. + * For details on originality checking, you must have an non-disclosure agreement (NDA) with the manufacturer who will provide you with the relevant documentation. + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_OriginalityChecking_M + + /** @defgroup Card_Tag_CardFeatures_ISO144434_4_M ISO14443-4 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO144434_4_M + + /** @defgroup Card_Tag_CardFeatures_ISO7816_M ISO7816 Protocol + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_ISO7816_M + + /** @defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M General purpose cryptographic functions + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_GeneralPurposeCrypto_M + + /** @defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M Cryptographic hashing algorithms + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_CryptoHashAlgorithms_M + + /** @defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M Digital signature verification + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_DigitalSignatureVerification_M + + /** @defgroup Card_Tag_CardFeatures_MRTD_M Machine Readable Travel Documents (MRTD) support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_MRTD_M + + /** @defgroup Card_Tag_CardFeatures_TLS_M TLS 1.2 with TLS/SSL Client Certificate Authentication using Generic Identity Device Specification (GIDS) smart card support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TLS_M + + /** @defgroup Card_Tag_CardFeatures_EMV_M Europay, Mastercard, Visa (EMV) standard support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_EMV_M + + /** @defgroup Card_Tag_CardFeatures_AntiCollision_M Anti-collision support i.e. multi card reader mode + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_AntiCollision_M + + /** @defgroup Card_Tag_CardFeatures_TransceiveMode_M Transeive mode support + * @{ + */ + /**@}*/ // end of defgroup Card_Tag_CardFeatures_TransceiveMode_M + + /**@}*/ // end of defgroup Card_Tag_CardFeatures_M + + /**@}*/ // end of defgroup Card_Tag_M + + /** @defgroup Miscellaneous_M Miscellaneous + * @{ + */ + /**@}*/ // end of defgroup Miscellaneous_M + + /**@}*/ // end of defgroup MultiReader + + /** @defgroup uFR_MDK uFR MDK (Mobile Development Kit) + * @since uFCoder library version 6.0.0 + * + * Using the internal NFC antenna of a mobile device is supported in the uFCoder library through the usage of ReaderOpenEx() with appropriate parameters. + * It is mandatory to obtain a valid DLogic license to make use of the uFR MDK. + * License can be obtained automatically through the ReaderOpenEx() API call. + * Or using the GetLicenseRequestData() and our online service found at: https://liblic.d-logic.com/
+ * Refer to @ref LibLic group for details. + * + * @{ + */ + /** @defgroup uFR_MDK_Android Android + * @brief uFR MDK for Android currently has support for the NTAG2XX, Mifare Classic®, Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * @{ + */ + /** @defgroup uFR_MDK_Android_NTAG2XX NTAG2XX with NDEF support + * @brief Supported API calls for NTAG2XX (e.g NTAG203/210/213/215/216) cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * read_ndef_record() + * * write_ndef_record() + * * write_ndef_record_mirroring() + * * write_ndef_record_mirroring_tt() + * * get_ndef_record_count() + * * erase_last_ndef_record() + * * erase_all_ndef_records() + * * ndef_card_initialization() + * * WriteNdefRecord_WiFi() + * * WriteNdefRecord_BT() + * * WriteNdefRecord_SMS() + * * WriteNdefRecord_Bitcoin() + * * WriteNdefRecord_GeoLocation() + * * WriteNdefRecord_NaviDestination() + * * WriteNdefRecord_Email() + * * WriteNdefRecord_Address() + * * WriteNdefRecord_AndroidApp() + * * WriteNdefRecord_Text() + * * WriteNdefRecord_StreetView() + * * WriteNdefRecord_Skype() + * * WriteNdefRecord_Whatsapp() + * * WriteNdefRecord_Viber() + * * WriteNdefRecord_Contact() + * * WriteNdefRecord_Phone() + * * ReadNdefRecord_WiFi() + * * ReadNdefRecord_Bitcoin() + * * ReadNdefRecord_GeoLocation() + * * ReadNdefRecord_NaviDestination() + * * ReadNdefRecord_Email() + * * ReadNdefRecord_Address() + * * ReadNdefRecord_AndroidApp() + * * ReadNdefRecord_Text() + * * ReadNdefRecord_StreetView() + * * ReadNdefRecord_Skype() + * * ReadNdefRecord_Whatsapp() + * * ReadNdefRecord_Viber() + * * ReadNdefRecord_Contact() + * * ReadNdefRecord_Phone() + * * ReadNdefRecord_SMS() + * * ReadNdefRecord_BT() + * * ParseNdefMessage() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_NTAG2XX + + /** @defgroup uFR_MDK_Android_Mifare Mifare Classic + * @brief Supported API calls for Mifare Classic cards: + * + * * GetCardIdEx() + * * GetDlogicCardType() + * * BlockRead_PK() + * * BlockInSectorRead_PK() + * * BlockWrite_PK() + * * BlockInSectorWrite_PK() + * * LinearRead_PK() + * * LinearWrite_PK() + * * SectorTrailerWrite_PK() + * * SectorTrailerWriteUnsafe_PK() + * * ValueBlockRead_PK() + * * ValueBlockWrite_PK() + * * ValueBlockInSectorRead_PK() + * * ValueBlockInSectorWrite_PK() + * * ValueBlockIncrement_PK() + * * ValueBlockDecrement_PK() + * * ValueBlockInSectorIncrement_PK() + * * ValueBlockInSectorDecrement_PK() + * * LinearFormatCard_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Mifare + + /** @defgroup uFR_MDK_Android_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth() + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth() + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_Desfire + + /** @defgroup uFR_MDK_Android_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_Android_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_Android + + /** @defgroup uFR_MDK_iOS iOS + * @brief uFR MDK for IOS currently has support only for Mifare DESFire® tags and ISO 14443-4 protocol via APDU commands. + * + * @{ + */ + /** @defgroup uFR_MDK_iOS_Desfire Mifare DESFire + * @brief Supported API calls for Mifare DESFire® cards: + * + * * DES_to_AES_key_type() + * * AES_to_DES_key_type() + * * uFR_int_DesfireFreeMem() + * * uFR_int_DesfireFormatCard_PK() + * * uFR_int_DesfireFormatCard_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_PK() + * * uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK() + * * uFR_int_DesfireDeleteFile_PK() + * * uFR_int_DesfireDeleteFile_aes_PK() + * * uFR_int_DesfireCreateAesApplication_PK() + * * uFR_int_DesfireCreateAesApplication_aes_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_PK() + * * uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK() + * * uFR_int_DesfireDeleteApplication_PK() + * * uFR_int_DesfireDeleteApplication_aes_PK() + * * uFR_int_DesfireGetKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_PK() + * * uFR_int_DesfireChangeKeySettings_aes_PK() + * * uFR_int_DesfireChangeAesKey_aes_PK() + * * uFR_int_DesfireChangeMasterKey_PK() + * * uFR_int_DesfireReadStdDataFile_aes_PK() + * * uFR_int_DesfireReadStdDataFile_no_auth + * * uFR_int_DesfireWriteStdDataFile_aes_PK() + * * uFR_int_DesfireWriteStdDataFile_no_auth + * * uFR_int_DesfireGetStdFileSize_aes_PK() + * * uFR_int_DesfireGetFileSettings_aes_PK() + * * uFR_int_DesfireGetFileSettingsSdm_aes_PK() + * * uFR_int_DesfireChangeFileSettings_aes_PK() + * * uFR_int_DesfireChangeFileSettingsSdm_PK() + * * uFR_int_DesfireSetTransactionTimer_aes_PK() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_iOS_Desfire + + + /** @defgroup uFR_MDK_IOS_ISO14443_4 ISO 14443-4 protocol + * @brief Supported API calls for ISO 14443-4 APDU commands: + * + * * SetISO14443_4_Mode() + * * APDUHexStrTransceive() + * * APDUPlainTransceive() + * * s_block_deselect() + * @{ + */ + /** @}*/ // end of defgroup uFR_MDK_IOS_ISO14443_4 + + /** @}*/ // end of defgroup uFR_MDK_iOS + + /**@}*/ // end of defgroup uFR_MDK + + //-------------------------------------------------------------------------------------------------- + /** + * @brief Used to generate license request necessary for obtaing valid uFCoder license separately. + * + * Parameter "license_request" will hold a JSON string value that is to be used for our online front-end service for generating an offline license. + * The online service is found at: https://liblic.d-logic.com/ + * + * @ingroup LibLic + * + * @param months Number of months requested for the license + * @param license_request JSON string formed with licensing parameters + * + */ + void DL_API GetLicenseRequestData(uint32_t months, OUT char *license_request); + + /** + * @brief Used to validate and store an offline Dlogic license for future usage. + * + * @ingroup LibLic + * + * @param license_str JSON string containing full license data + * + * @return Operation status + */ + UFR_STATUS DL_API SetLicenseData(c_string license_str); + + /** + * @brief Opens reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s. If you have more than one µFR Online device, ReaderOpen function will open the first one found, for the device not connected to the PC via cable, use ReaderOpenEx() instead. + *
+ * NOTE: On Android, using ReaderOpen() will establish communication with uFR Series readers connected via OTG cable. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen(void); + + /** + * @brief Opens a port of connected reader using readers family type. Useful for speed up opening for non uFR basic reader type (e.g. BaseHD with uFR support). + * + * Do not use this function for opening communication with µFR Online devices. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenByType(uint32_t reader_type); + + enum E_READER_TYPE + { + AUTO = 0, + UFR_TYPE = 1, + UFR_RS232_TYPE = 2, + BASEHD_UFR_TYPE = 3, + UFR_ONLINE_TYPE = 4, + INTERNAL_NFC = 5 + }; + + /** + * @brief Open reader communication port in several different ways. Can be used for establishing communication with COM port too. + * + * There is enumeration in uFCoder.h file called E_READER_TYPE with values: + * enum E_READER_TYPE + * { + * AUTO = 0, + * UFR_TYPE = 1, + * UFR_RS232_TYPE = 2, + * BASEHD_UFR_TYPE = 3, + * UFR_ONLINE_TYPE = 4, + * INTERNAL_NFC = 5 + * }; + * Values in this enumeration you can pass into ReaderOpenEx function as reader_type parameter.
+ * For example, if you pass 4 as reader_type it will only work with µFR Online Series devices, and then as port_name you can pass devices IP address or serial number (ex: “192.168.1.123” or “ON101390”), for port_interface you can pass ‘U’ for UDP, ‘T’ for TCP or 0. + * If you pass 0, it will automatically search for reader working mode (UDP or TCP) and open it. For argument you can pass 0 or µFR Nano device serial number to open it on 1Mbit/s (ex: “UN123456”).
+ * Using value 5 as reader_type implies usage of internal mobile device NFC. + * Upon a call to ReaderOpenEx with this parameter, the library will try to obtain license automatically via HTTP. + * On success, a valid license is stored for future use. On failure, it moves to looking up for stored licenses. Results other than UFR_OK status imply a corresponding error that occurred and as such use of internal mobile device NFC will be unavailable. + * When using 5 as reader_type, additionally you can specify port_interface parameter to decide whether to do online->offline validation or just offline. To use offline-only validation of a previously stored valid DLogic license, set port_interface to 1. + * Value 0 is default value for port_interface and implies online->offline license validation. + * More examples for port open are given in the “Reader Open Examples” document: + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-doc/blob/master/Reader_Open_Examples.pdf + * Examples: + * ReaderOpenEx(1, “COM1”, 0, 0) + * This example will open communication with µFR device attached to COM1 port on 1Mbit/s + * ReaderOpenEx(1, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR device on 1Mbit/s + * ReaderOpenEx(2, 0, 0, 0) + * This example will automatically find COM port and open communication with first µFR RS232 device on 115200 bit/s + * ReaderOpenEx(4, “ON123456”, ‘U’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on UDP protocol. + * ReaderOpenEx(4, “ON123456”, ‘T’, 0) + * This example will open communication with µFR Online reader with serial number ON123456 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘U’, 0) + * This example will open communication with µFR Online reader with IP address 192.168.1.123 on UDP protocol. + * ReaderOpenEx(4, “192.168.1.123”, ‘T’, 0) + * This will open communication with µFR Online reader with IP address 192.168.1.123 on TCP protocol. + * ReaderOpenEx(4, “192.168.1.123”, 0, 0) + * It will open communication with µFR Online reader with IP address 192.168.1.123 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, 0) + * It will open communication with µFR Online reader with serial number ON123456 based on its working protocol (UDP or TCP), because we passed 0 as port_interface + * ReaderOpenEx(4, “ON123456”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with serial number ON123456 + * ReaderOpenEx(4, “192.168.1.123”, 0, “UN654321”) + * It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with IP address 192.168.1.123 + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) When uFR Online reader works in BT serial mode or transparent mode, reader_type must be set to 1. + * @param port_name is c-string type used to open port by given serial name. If you provide NULL or empty string that is AUTO MODE which calls ReaderOpenEx() and all available ports on the system. serial port name, identifier, like "COM3" on Windows or "/dev/ttyS0" on Linux or "/dev/tty.serial1" on OS X or if you select FTDI, reader serial number like "UN123456", if reader have integrated FTDI interface When the UDP interface type is selected, port_name must be provided in “address:port” format. Like "192.168.1.162:8881" IP for UDP I/F + * @param port_interface type of communication interfaces (define interface which we use while connecting to the printer), supported value's: 0 : auto - first try FTDI than serial if port_name is not defined 1 : try serial / virtual COM port / interfaces 2 : try only FTDI communication interfaces 10 : try to open Digital Logic Shields with RS232 uFReader on Raspberry Pi (serial interfaces with GPIO reset) 84 ('T') : TCP/IP interface 85 ('U') : UDP interface 102 ('B'): BT serial interface. Android library only. 114 ('L'): BLE interface. Android library only. When uFR Online reader works in BT serial mode, port_interface must be set to 0 (Except Android). arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * @param arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenEx(uint32_t reader_type, IN c_string port_name, uint32_t port_interface, IN void *arg); + + /** + * @brief Opens uFR Online device by serial number. + * + * Function will open communication (UDP or TCP) with device based on its working mode. If function cannot find given serial number, it will open communication on serial port with 1Mbit/s. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param serial_number Pointer to const char array (c_string) containing devices serial number (ex. “ON101390”). + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpen_uFROnline(c_string serial_number); + + /** + * @brief Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderReset(void); + + /** + * @brief Physical reset of reader communication port & tests the communication before returning a UFR_STATUS code. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetWait(void); + + /** + * @brief Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderClose(void); + + /** + * @brief This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestart(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderHwReset(void); + + /** + * @brief Used to get the FTDI D2XX driver version number. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major: Byte value indicating driver version major number + * @param version_minor: Byte value indicating driver version minor number + * @param build: Byte value indicating driver version build number + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor, VAR uint8_t *build); + + /** + * @brief Used to get the FTDI D2XX driver version number as c-string. The communication with the reader needs to be established via ReaderOpen() or ReaderOpenEx() beforehand. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_str: buffer that will contain driver version as c-string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetFtdiDriverVersionStr(OUT char *version_str); + + /** + * @brief Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderType(VAR uint32_t *lpulReaderType); + + /** + * @brief Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information + * + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumber(VAR uint32_t *lpulSerialNumber); + + /** + * @brief Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information + * + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnected(VAR uint32_t *connected); + + /** + * @brief Store a new key or change existing key under provided index parameter. + * + * The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWrite(IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLock(IN const uint8_t *password); + + /** + * @brief Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlock(IN const uint8_t *password); + + /** + * @brief This function turns sound and light reader signals. + * + * Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignal(uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). + * + * Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolume(uint8_t sound_volume); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserData(OUT uint8_t *aucData); + + /** + * @brief Read user data written in device NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 bytes array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExt(OUT uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 16 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 16 byte array containing user data + * @return Operation status + */ + UFR_STATUS DL_API WriteUserData(IN const uint8_t *aucData); + + /** + * @brief Write user data into the device's NV memory. + * + * User data is 32 byte long. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param aucData pointer to a 32 byte array containing user data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExt(IN const uint8_t *aucData); + + /** + * @brief Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). + * + * We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @ingroup Card_Tag_General + * + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardId(VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * @ingroup Miscellaneous + * + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSak(VAR uint16_t *atqa, VAR uint8_t *sak); + + /** + * @brief Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKey(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular block using absolute Block address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKey(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKey(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Write particular block using relative Block in Sector address. + * + * *only uFR CS with SAM support. + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKey(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKey(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead(OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesReturned, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, VAR uint16_t *lpusBytesWritten, + uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief These functions are used for writing data to the card using emulation of the linear address space. + * The method for proving authenticity is determined by the suffix in the functions names. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKey(IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKey(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKey(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKey(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKey(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKey(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKey(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * *only uFR CS with SAM support + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKey(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute Block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 1 (AKM1) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. + * + * Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2(int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Automatic Key Mode 2 (AKM2) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Provided Key mode (PK) Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PK(OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PK(IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PK(OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PK(IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. + * + * When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read Linear data Address Space. + * + * On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PK(OUT uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_returned, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) These functions are used for writing data to the card using emulation of the linear address space. + * + * The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare + * + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned Pointer to variable holding how many bytes are returned auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param bytes_written Pointer to variable holding how many bytes are written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PK(IN const uint8_t *data, uint16_t linear_address, uint16_t length, VAR uint16_t *bytes_written, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param new_key_B Pointer on 6 bytes array containing a new KeyA lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PK(IN const uint8_t *new_key_A, uint8_t blocks_access_bits, uint8_t sector_trailers_access_bits, + uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, VAR uint8_t *lpucSectorsFormatted, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, uint8_t block0_access_bits, + uint8_t block1_access_bits, uint8_t block2_access_bits, uint8_t sector_trailer_access_bits, + uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. + * + * It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare + * + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 key_index Index of reader’s key to be used (RK mode) key Pointer to 6 byte array containing key bytes (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PK(uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockWrite Function description Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockWrite(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockWrite_AKM1(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_AKM2(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockWrite_PK(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockWriteSamKey(int32_t *value, uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Read particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PK(VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PK(int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Write particular Value block using absolute Block address. + * + * This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PK(int32_t value, uint8_t value_addr, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PK(int32_t increment_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Increments particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param increment_value value showing how much initial block value will be incremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PK(int32_t increment_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using absolute Block address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare + * + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PK(int32_t decrement_value, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information + * + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersion(VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTime(VAR uint8_t *time); + + /** + * @brief Function sets the date and time into the device's RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC + * + * @param password pointer to the 8 bytes array containing password time pointer to the 6 bytes array containing date and time representation + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief This function is used in Common, Advance and Access Control set of functions. + * + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM. Maximal length of array is 128 bytes. + * + * Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * @param password pointer to array containing password Functions that works with Mifare Desfire Card (AES encryption in reader) AES encryption and decryption is performed in the reader. AES keys are stored into reader. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeSector(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API SubscribeBlock(uint8_t block_nr, uint32_t admin_serial); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BusAdminCardMake(uint32_t serial, IN uint8_t *password); + + /** + * @brief Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information + * + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescription(OUT uint8_t pSerialDescription[8]); + + /** + * @brief Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information + * + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumber(VAR uint8_t *build); + + /** + * @brief This function returns UID of card actually present in RF field of reader. It can handle all three known types : 4, 7 and 10 byte long UIDs. + * + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General + * + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdEx(VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi-card (anti collision) mode: + //------------------------------------------------------------------------------ + /** + * @brief This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollision(void); + + /** + * @brief Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollision(void); + + /** + * @brief If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. + * + * Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCards(VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + /** + * @brief For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. + * + * First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * Before calling this function you have to call EnumCards() first. + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCards(OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + /** + * @brief Selects one of the cards which UID is on the actual UID list of the enumerated cards. + * + * If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCard(IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. + * + * Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCard(void); + + /** + * @brief Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision + * + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatus(VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + //------------------------------------------------------------------------------ + /** + * @brief This function returns card type according to DlogicCardType enumeration. + * + * For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General + * + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardType(VAR uint8_t *lpucCardType); + + /** + * @brief This function returns card manufacturer as char* buffer (c-style string). + * + * For details, please refer to the ISO/IEC JTC1/SC17 STANDING DOCUMENT 5 + * + * @ingroup Card_Tag_General + * + * @param card_manufacturer_str manufacturer name as c_string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardManufacturer(OUT char *card_manufacturer_str); + + /** + * @brief This function returns 8 bytes of the T2T version. + * + * All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersion(OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). + * + * The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General + * + * @param lpulLinearSize pointer to variable which contain size of user data space lpulRawSize pointer to variable which contain size of total data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSize(VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * @ingroup Miscellaneous + * + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatus(OUT uint8_t *tt_message, VAR uint8_t *tt_status); + //------------------------------------------------------------------------------ + /** + * @brief Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. + * + * The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @ingroup Card_Tag + * + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalData(OUT uint8_t data[32], VAR uint32_t *len); + + /** + * @brief Function returns reader’s serialized discovery loop structure. + * + * C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetup(OUT uint8_t *setupStruct, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoop(IN const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Function returns the AID set in the reader to retrieve the mobile phone's unique ID. + * + * If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAid(OUT uint8_t *aid, VAR uint32_t *len); + + /** + * @brief Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures + * + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAid(IN const uint8_t *aid, uint32_t len); + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfig(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtp(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlot(uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfiguration(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKey(void); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencrypted(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKey(uint8_t key_slot, uint8_t pub_key_id[4], uint8_t bool_enabled, + uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZone(uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZone(uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatus(VAR uint8_t *bool_config_zone_locked, VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevision(uint8_t revision[4]); + //------------------------------------------------------------------------------ + + // uFCoder PRO MODE + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProMode(VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProMode(const uint32_t ReaderProMode); + + // QR barcode crypt algorithm + // initialization. with TB serial like 'TB123456' + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_Initialize(IN const uint8_t *TBSerialString, uint16_t job_number); + + // You must define 25 bytes array in memory for out_card_data[] + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCard(const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + enum CARD_ENCRYPTION_CODE_TYPE + { + CODE_TYPE_STANDARD, + CODE_TYPE_GROUP, + CODE_TYPE_DAILY_RANGE, // valid from, but only to_timestamp / every day + }; + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNext(const uint32_t code_type, const uint32_t from_timestamp, const uint32_t to_timestamp, + const uint32_t additional_data_size, IN const uint8_t additional_data[], + VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSN(OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSN(VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSN(OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Function returns TNF, type of record, ID and payload from the NDEF record. + * + * NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_record(uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. + * + * Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, IN uint8_t *id, + IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, VAR uint8_t *card_formated); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. + * + * NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_tt(uint8_t message_nr, IN uint8_t *tnf, IN uint8_t *type_record, IN uint8_t *type_length, + IN uint8_t *id, IN uint8_t *id_length, IN uint8_t *payload, IN uint32_t *payload_length, + VAR uint8_t *card_formated, int use_uid_ascii_mirror, int use_counter_ascii_mirror, + int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. + * + * Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_count(VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, OUT uint8_t *ndef_record_array, + VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_record(uint8_t message_nr); + + /** + * @brief Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF + * + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_records(uint8_t message_nr); + + /** + * @brief Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. + * + * If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initialization(void); + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + /** + * @brief Function stores a message record for NTAG emulation mode into the reader. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdef(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief This function does the same as WriteEmulationNdef() function with the addition of an AAR embedded in to the NDEF message. + * + * AAR stands for “Android Application Record”. AAR is a special type of NDEF record that is used by Google’s Android operating system to signify to an NFC phone that an explicitly defined Android Application which should be used to handle an emulated NFC tag. Android App record will be added as the 2nd NDEF record in the NDEF message. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record type_record pointer to the array containing record type type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param type_record pointer to the array containing record type + * @param type_length length of the record type id pointer to the array containing record ID id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param id pointer to the array containing record ID + * @param id_length length of the record ID payload pointer to the array containing record payload payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload aar pointer to the array containing AAR record aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * @param aar pointer to the array containing AAR record + * @param aar_length length of the AAR record TagEmulationStart Function description Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). In this mode, the reader can only answer to the commands issued by a following library functions: TagEmulationStart(), WriteEmulationNdef(), TagEmulationStop(), GetReaderSerialNumber(), GetReaderSerialDescription(), GetReaderHardwareVersion(), GetReaderFirmwareVersion(), GetBuildNumber() Calls to the other functions in this mode returns following error code: FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefWithAAR(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, uint8_t id_length, + IN uint8_t *payload, uint8_t payload_length, IN uint8_t *aar, uint8_t aar_length); + + /** + * @brief Put the reader permanently in a NDEF tag emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStart(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStop(void); + + /** + * @brief Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStart(void); + + /** + * @brief Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). + * + * uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStart(void); + + /** + * @brief Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStop(void); + + /** + * @brief This function returns current ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParams(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief This command set ad-hoc emulation parameters. + * + * On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 CombinedModeEmulationStart Function description Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. Function declaration (C language) UFR_STATUS CombinedModeEmulationStart(void); Function takes no parameters. ________________ Support for ISO14443-4 protocol + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParams(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode + * + * @param is_field_present value representing whehter field is present (1) or not (0) + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldState(VAR uint8_t *is_field_present); + + /** + * @brief Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommMode(void); + + /** + * @brief The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop(). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommMode(void); + + /** + * @brief Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRam(IN uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM + * + * @param ram_data buffer containing ram data returned + * @param addr address from which to read reader RAM + * @param data_len length of data to read from RAM + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRam(OUT uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Function stores a message record for NTAG emulation mode into the reader in the RAM. + * + * Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRam(uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, + IN uint8_t *id, uint8_t id_length, IN uint8_t *payload, uint32_t payload_length); + + /** + * @brief Put the reader permanently in a NDEF tag in RAM emulation mode. + * + * Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStopRam() function), or by reader reset. Use the function GetReaderStatus to check if the reader is still in emulation mode (maybe the reader was reset for some reason). + * From library version 5.0.31, and firmware version 5.0.31 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartRam(void); + + /** + * @brief Allows the reader permanent exit from a NDEF tag emulation mode. + * + * From library version 5.0.31, and firmware version 5.0.33 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopRam(void); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value sets to 0. + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function enables the 24 bit NFC counter. + * + * Counter increased by the first valid READ command in the NTAG emulation mode, after the external RF field detected. Counter is represented in 6 bytes of ASCII code, when the NDEF message is read. For example if the counter value is 0x56, it will be represented as 000056, at the end of the NDEF message. Position of the counter mirror start byte must be entered as a function parameter. This is the absolute position in the card emulation data array. + * Counter value stays unchangeable. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @param mirror_pos Position in the card emulation data array + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterNonResetEnabled(uint16_t mirror_pos); + + /** + * @brief Function disables the NFC counter in the card emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationMirrorCounterDisabled(void); + + //------------------------------------------------------------------------------ + + // GetNfcT2TVersion() returns 8 bytes (see T2T documentation): + typedef struct t2t_version_struct + { + uint8_t header; + uint8_t vendor_id; + uint8_t product_type; + uint8_t product_subtype; + uint8_t major_product_version; + uint8_t minor_product_version; + uint8_t storage_size; + uint8_t protocol_type; + } t2t_version_t; + + // NfcT2TSafeConvertVersion() returns converts version_record that returned from GetNfcT2TVersion() + // or GetNfcT2TVersionM(). Conversion is "alignment safe" + // (you don't need to pay attention on structure byte alignment): + /** + * @brief This is a helper function for converting raw array of 8 bytes received by calling GetNfcT2TVersion(). + * + * All modern T2T chips having same or very similar structure of the T2T version data represented in the uFR API by the structure type t2t_version_t: + * typedef struct t2t_version_struct { + * uint8_t header; + * uint8_t vendor_id; + * uint8_t product_type; + * uint8_t product_subtype; + * uint8_t major_product_version; + * uint8_t minor_product_version; + * uint8_t storage_size; + * uint8_t protocol_type; + * } t2t_version_t; + * This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). Conversion done by this function is "alignment safe". + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param version pointer to the structure of the t2t_version_t type which will receive converted T2T version + * @param version_record pointer to array containing 8 bytes of the raw T2T version acquired using function GetNfcT2TVersion() + * + */ + void DL_API NfcT2TSafeConvertVersion(t2t_version_t *version, const uint8_t *version_record); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignature(OUT uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], VAR uint8_t *lpucUidLen, + VAR uint8_t *lpucDlogicCardType); + + /** + * @brief This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExt(OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + /** + * @brief This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounter(uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. + * + * Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounter(uint8_t counter_address, uint32_t inc_value); + + /** + * @brief This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. + * + * If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounter(VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RK(VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Provided Key mode (PK) This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. + * + * If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX + * + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PK(VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfig(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigEx(uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfig(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigEx(VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, VAR uint8_t *suffix, + VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only. Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode idle mode value + * @param card_detection_mode card detection mode value + * @param idle_color idle color value(RGB) + * @param card_detection_color card detection color value(RGB) + * @param enabled enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfig(uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only. Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param idle_mode pointer to idle mode value + * @param card_detection_mode pointer to card detection mode value + * @param idle_color pointer to idle color value(RGB) + * @param card_detection_color pointer to card detection color value(RGB) + * @param enabled pointer to enabled flag + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfig(uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_number(VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, uint8_t start_hour, + uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record(uint8_t record_number, VAR uint16_t *first_reader_nr, VAR uint16_t *last_reader_nr, + VAR uint8_t *start_hour, VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_record(uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_record(uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, uint8_t begin_hour, + uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, uint8_t end_hour, + uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_record(VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, VAR uint8_t *end_month, + VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_type(uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_type(VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_duration(uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_duration(VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_duration(uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_duration(VAR uint32_t *duration); + + // swimming pool ************************************************************** + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validity(VAR int32_t *credit, VAR uint32_t *begin_year, VAR uint32_t *begin_month, + VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, + VAR uint32_t *end_year, VAR uint32_t *end_month, VAR uint32_t *end_day, + VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validity(int32_t credit, uint32_t begin_year, uint32_t begin_month, uint32_t begin_day, + uint32_t begin_hour, + uint32_t begin_minute, + uint32_t end_year, uint32_t end_month, uint32_t end_day, uint32_t end_hour, + uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_record(uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_record(uint8_t record_number, VAR uint8_t *right_record_type, OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counter(uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, + uint8_t end_minute, IN uint8_t *days, uint8_t max_daily_counter); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_record_type_max_daily_counter(uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, + VAR uint8_t *start_minute, VAR uint8_t *end_hour, VAR uint8_t *end_minute, + OUT uint8_t *days, VAR uint8_t *max_daily_counter); + + //============================================================================= + + /** + * @brief Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOn(uint16_t pulse_duration); + + /** + * @brief Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayState(uint8_t state); + + /** + * @brief Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param intercom shows that there is voltage at the terminals for intercom connection, or notss + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoState(VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControl(uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Function gets the state of the input pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR + * + * @param input_nr ordinal number of hardware specific input pin input_state input state 1 or 0. + * @param input_state input state 1 or 0. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetInputState(uint8_t input_nr, VAR uint8_t *input_state); + + /** + * @brief This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControl(uint8_t light_status); + + /** + * @brief For classic uFR PLUS devices only. The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. + * + * This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControl(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Sets the color of the RGB diodes. + * + * This color stays on the RGB diodes until the function GreenLedBlinkingTurnOn() is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity(). + * Before this function call, the function GreenLedBlinkingTurnOff() must be called, or the reader is already in mode of blocking automatic signalization. + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControl(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControl(uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes. + * + * This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleep(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. + * + * In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. + * Function also sets the number of omitted activity periods, when the RGB light is off. + * For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriod(uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSet(uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefault(void); + + /** + * @brief The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. + * + * Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMax(uint8_t bad_select_nr_max); + + /** + * @brief The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary + * + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMax(VAR uint8_t *bad_select_nr_max); + + /** + * @brief Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepMode(void); + + /** + * @brief Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepMode(void); + + /** + * @brief Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSet(uint8_t seconds_wait); + + /** + * @brief Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep + * + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGet(VAR uint8_t *seconds_wait); + + /** + * @brief This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanently(unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParameters(VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. + * + * Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. + * The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. + * For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayData(IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Function has the same functionality as the function SetDisplayData(). New feature is the RGB port selection. + * + * Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbData(IN uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequency(uint16_t frequency); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * SetRgbIntensity()(alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * GetRgbIntensity (alias from version 5.0.55) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensity(VAR uint8_t *intensity); + + /** + * @brief Function sets the intensity of light on the display. + * + * Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbIntensity(uint8_t intensity); + + /** + * @brief Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_RGBSignalization + * + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRgbIntensity(VAR uint8_t *intensity); + // DESFIRE functions ************************************************************** + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode(void); + + /** + * @brief Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATS(OUT uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorage(void); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceive(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint32_t *ufr_status); + + /** + * @brief Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Transceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, uint8_t data_out_len, + OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, uint8_t send_le, + OUT uint8_t *apdu_status); + + /** + * @brief Sends C–APDU in the c_string (zero terminated) format, containing pairs of the hexadecimal digits. + * + * Pairs of the hexadecimal digits can be delimited by any of the punctuation characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu C-APDU hexadecimal c_string + * @param r_apdu Received R-APDU as a hexadecimal c_string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceive(IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are sent and receive in the form of the byte arrays. + * + * There is obvious need for a c_apdu_len and *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceive(IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * @ingroup UNDOCUMENTED + * + * @param c_apdu array containing C_APDU + * @param c_apdu_len length of C_APDU + * @param r_apdu buffer that will store R_APDU + * @param r_apdu_len returns length of R_APDU + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeap(IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief This is “exploded binary” alternative function intended for support APDU commands in ISO 14443-4A tags. + * APDUTransceive() receives separated parameters which are an integral part of the C– APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param cls cls + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceive(uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, uint32_t Nc, + OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chain(uint8_t chaining, uint8_t timeout, uint8_t block_length, IN uint8_t *snd_data_array, + VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, VAR uint8_t *rcv_chained, + VAR uint32_t *ufr_status); + + /** + * @brief R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceive(uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4 + * + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselect(uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * @ingroup UNDOCUMENTED + * + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive(uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, uint8_t crypto1, + uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Function sets the parameters for transceive mode. + * + * If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_start(uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stop(void); + + /** + * @brief Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enable(void); + + /** + * @brief The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode + * + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending rcv_data pointer to data array received from card bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card rcv_len number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceive(IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, uint32_t bytes_to_receive, + VAR uint32_t *rcv_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interface(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_Generic(OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interface(void); + + /** + * @brief Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDU(void); + + /** + * @brief Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4(void); + + /** + * @brief Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interface(void); + + /** + * @brief APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816 + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interface(void); + + //============================================================================== + /** + * @brief Using this function you can select the appropriate application on the card. + * + * For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAid(IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief In JCApp cards you can put two types of asymmetric crypto keys. + * + * Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKey(uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + IN const uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPair(uint8_t key_type, uint8_t key_index, uint8_t key_designator, uint16_t key_bit_len, + IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPair(uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPair(uint8_t key_index); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBegin(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *chunk, + uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdate(IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEnd(VAR uint16_t *sig_len); + + /** + * @brief This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignature(uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *plain_data, + uint16_t plain_data_len, VAR uint16_t *sig_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Finally, to get a signature, you have to call JCAppGetSignature(). + * + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior calling of this function you have to be logged in with an User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param sig Pointer to an array of “sig_len” bytes length. Value of the “sig_len” you've got as a parameter of the JCAppSignatureEnd() or JCAppGenerateSignature() functions. You have to allocate those bytes before calling this function. + * @param sig_len Length of the allocated bytes in a sig array. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetSignature(OUT uint8_t *sig, uint16_t sig_len); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObj(uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, uint8_t id_size); + + /** + * @brief Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubject(uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Using this function you can delete certificate objects from a card. + * + * This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCert(uint8_t obj_type, uint8_t obj_index); + + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjId(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubject(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + /** + * @brief This function you always have to call 2 times. + * + * Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObj(uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + /** + * + * @ingroup Card_Tag_JavaCardApplication + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + c_string DL_API JCAppGetErrorDescription(UFR_STATUS apdu_error_status); + + /** + * @brief This function is used to login to the JCApp with an appropriate PIN code. + * + * Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. JCAppGetPinTriesRemaining Function description This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. This function have parameter of the type dl_sec_code_t which is defined as: typedef enum { USER_PIN = 0, SO_PIN, USER_PUK, SO_PUK } dl_sec_code_t; + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLogin(uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemaining(dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t. + * + * Which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code. + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChange(dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief This function is used to unblock PIN code which is specified by the SO parameter. + * + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common + * + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblock(uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common + * @ingroup UNDOCUMENTED + * + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisable(uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKey(uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, OUT uint8_t *exponent, + VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKey( + uint8_t key_index, OUT uint8_t *keyW, + VAR uint16_t *keyWSize, + OUT uint8_t *field, VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, VAR uint16_t *g_size, + OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature + * @ingroup UNDOCUMENTED + * + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBits(uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + //------------------------------------------------------------------------------ + /** + * @brief This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. + * + * Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list_size ointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSize(VAR uint32_t *list_size); + + /** + * @brief After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFiles(OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief This function returns file size indexed by the parameter card_file_index, on successful execution. + * + * Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file which size we want to get. + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSize(uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. + * + * On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFile(uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief This function reads a file from the DLStorage card directly to the new file on the host file-system. + * + * If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. + * + * Parameter data_size defines the amount of data to be written in the file on the DLStorage card. + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFile(uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief This function writes file content from the host file-system to the new file on the DLStorage card. + * + * If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystem(uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief After successful call to this function, the file on the DLStorage card will be deleted. + * + * Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage + * + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFile(uint8_t file_index); + //------------------------------------------------------------------------------ + /** + * @brief This function is used to get hash output length in bytes for specified hash algorithms. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator for which we want to get output length in bytes. Use values declared in E_HASH_ALGS enumeration. + * @param out_byte_len After successful function execution, the variable on which this pointer points to, will contain output hash length in bytes for specified hash algorithm. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashOutputByteLength(uint32_t hash_algo, VAR uint32_t *out_byte_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions) + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHash(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, OUT uint8_t *hash, uint32_t hash_alocated); + + /** + * @brief This function calculates and returns the hash of the data in the buffer pointed by the “in” function parameter. + * + * Hash algorithm is specified by the hash_algo function parameter. + * If output bytes don't match with hash_alocated function parameter function returns CRYPTO_SUBSYS_WRONG_HASH_OUTPUT_LENGTH status. + * GetHashToHeap() automatically allocates memory, which *hash parameter will point to after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used for calculation. Use values declared in E_HASH_ALGS enumeration. + * @param in Input buffer of which hash is calculated. + * @param in_len Input buffer length in bytes. Maximum buffer length is 32 KB. If you have more data, use the chunked hashing method (see usage instructions of the DLHashInitChunked(), DLHashUpdateChunked() and DLHashFinishChunked() functions). + * @param hash After successful function execution, the variable on which this pointer points to, will contain the pointer to the output hash. + * @param hash_len After successful function execution, the variable on which this pointer points to, will contain output hash length. + * + * @return Operation status + */ + UFR_STATUS DL_API DLGetHashToHeap(uint32_t hash_algo, IN const uint8_t *in, uint32_t in_len, VAR uint8_t **hash, VAR uint32_t *hash_len); + + /** + * @brief This function is used in conjunction with DLHashUpdateChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() has to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash_algo Hash designator which specifies the hash algorithm used in the following hashing sequence. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashInitChunked(uint32_t hash_algo); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param in One of the chunks of data of which hash is calculated. + * @param in_len Chunk length in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashUpdateChunked(IN const uint8_t *in, uint32_t in_len); + + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunked(OUT uint8_t *hash, uint32_t hash_alocated); + /** + * @brief This function is used in conjunction with DLHashInitChunked() and DLHashUpdateChunked() functions. + * + * These functions have the same result as the single call to DLGetHash() or DLGetHashToHeap() functions but they are used for larger amounts of data to hash. + * These functions have to be called in the specific sequence. Disruption of the calling sequence leads to unpredictable results. In every hashing sequence, DLHashInitChunked() have to be called exactly once, in the beginning of the sequence. After successful hashing sequence initialization, there can be as many as needed DLHashUpdateChunked() calls. Chunk sizes may vary throughout the sequence. At the end of the sequence there can be exactly one call to either DLHashFinishChunked() or DLHashFinishChunkedToHeap() function. These two functions differ only in that the DLHashFinishChunkedToHeap() automatically allocates space for a resulting hash while the DLHashFinishChunked() expects to store the result in an already allocated memory on the heap. Calling one of DLHashFinishChunked() or DLHashFinishChunkedToHeap() functions finishes the current hashing sequence. + * DLHashFinishChunkedToHeap() automatically allocates memory, which *hash parameter will point to, after successful execution. User is obligated to cleanup allocated memory space, occupied by the *hash, after use (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param hash After successful function execution, the variable on which this pointer points to, will contain output of the hashing sequence. + * @param hash_alocated This parameter should contain the number of bytes previously allocated in the hash buffer. This parameter have to be greater or equal to the output length of the hash algorithm which is specified by the hash_algo parameter passed in the previous call to the DLHashInitChunked(), in the beginning of the hashing sequence. + * + * @return Operation status + */ + UFR_STATUS DL_API DLHashFinishChunkedToHeap(OUT uint8_t **hash, VAR uint32_t *hash_alocated); + + /** + * @brief This function is used to verify the digital signature of the pre-hashed value or some relatively short plain text message. + * + * If there is no errors during the verification process and digital signature correspond to the "To Be Signed" (TBS) data array and public cryptographic key, the function returns UFR_OK status. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * In case of wrong digital signature, function returns CRYPTO_SUBSYS_WRONG_SIGNATURE status. + * Function can return following status codes in case of various errors: + * * CRYPTO_SUBSYS_NOT_INITIALIZED + * * CRYPTO_SUBSYS_INVALID_HASH_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_PADDING_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_CIPHER_ALGORITHM + * * CRYPTO_SUBSYS_INVALID_SIGNATURE_PARAMS + * * CRYPTO_SUBSYS_INVALID_RSA_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY + * * CRYPTO_SUBSYS_INVALID_ECC_PUB_KEY_PARAMS + * * CRYPTO_SUBSYS_UNKNOWN_ECC_CURVE + * * CRYPTO_SUBSYS_SIGNATURE_VERIFICATION_ERROR + * For digest_alg use one of the values declared in E_SIGNER_DIGESTS enumeration: + * enum E_SIGNER_DIGESTS { + * ALG_NULL = 0, + * ALG_SHA, + * ALG_SHA_256, + * ALG_SHA_384, + * ALG_SHA_512, + * ALG_SHA_224, + * ALG_SHA_512_224, + * ALG_SHA_512_256, + * SIG_DIGEST_MAX_SUPPORTED + * }; + * ALG_SHA is the designator for the SHA-1 algorithm. + * For padding_alg use one of the values declared in E_SIGNER_RSA_PADDINGS enumeration: + * enum E_SIGNER_RSA_PADDINGS { + * PAD_NULL = 0, + * PAD_PKCS1_V1_5, + * PAD_PKCS1_PSS, + * SIG_PAD_MAX_SUPPORTED + * }; + * PAD_PKCS1 is an alias of the PAD_PKCS1_V1_5 padding algorithm: + * #define PAD_PKCS1 PAD_PKCS1_V1_5 + * For cipher_alg use one of the values declared in E_SIGNER_CIPHERS enumeration: + * enum E_SIGNER_CIPHERS { + * SIG_CIPHER_RSA = 0, + * SIG_CIPHER_ECDSA, + * SIG_CIPHER_MAX_SUPPORTED + * }; + * When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * + * @ingroup Card_Tag_CardFeatures_DigitalSignatureVerification + * + * @param digest_alg in the E_SIGNER_DIGESTS enumeration. + * @param padding_alg in the E_SIGNER_RSA_PADDINGS enumeration. When the signer cipher algorithm is SIG_CIPHER_ECDSA, padding_alg is ignored and you can freely use PAD_NULL i.e. value 0 as a padding_alg. ECDSA data alignment in use is described in RFC6979 (section 2.3. - Integer Conversions). + * @param cypher_alg in the E_SIGNER_CIPHERS enumeration. tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param tbs Pointer to the “To Be Signed“ data array i.e. hash or relatively short plain text message whose digital signature is being verified. "To Be Signed" is just a colloquial term for already signed data, which is the origin of the digital signature. + * @param tbs_len Length of the “To Be Signed“ array (in bytes). signature Pointer to the signature array. signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param signature Pointer to the signature array. + * @param signature_len Length of the signature array (in bytes). sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param sig_params Pointer to the additional signature parameters. Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this pointer should point to the unsigned 4-byte integer containing the value of the cryptographic salt length. + * @param sig_params_len Length of the additional signature parameters (in bytes). Additional signature parameters are in use only when padding_alg is PAD_PKCS1_PSS and in that case this value should be 4 i.e. size of unsigned 4-byte integer. In other cases this parameter is ignored. pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key Pointer to the public key array. In the case of the RSA public key, this array should contain key modulus (‘N’). + * @param pub_key_len Length of the public key parameter pub_key (in bytes). pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. pub_key_params_len Length of the additional public key parameters (in bytes). + * @param pub_key_params Pointer to the additional public key parameters. In the case of the RSA public key, this array should contain a public key exponent array (‘e’). In the case of the ECC public key, this array should contain an elliptic curve definition array. To set an elliptic curve definition array you can use SetEllipticCurveByIndex() or SetEllipticCurveByName() functions. + * @param pub_key_params_len Length of the additional public key parameters (in bytes). + * + * @return Operation status + */ + UFR_STATUS DL_API DigitalSignatureVerifyHash(uint32_t digest_alg, uint32_t padding_alg, uint32_t cypher_alg, IN const uint8_t *tbs, + uint32_t tbs_len, IN const uint8_t *signature, uint32_t signature_len, + IN const void *sig_params, uint32_t sig_params_len, IN const uint8_t *pub_key, + uint32_t pub_key_len, IN const void *pub_key_params, uint32_t pub_key_params_len); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the hash algorithm designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param hash_algo Hash designator. Use values declared in E_HASH_ALGS enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetHashName(uint32_t hash_algo); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the ECC curve designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param eccCurve ECC curve designator. Use values declared in E_ECC_CURVES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetEccCurveName(uint32_t eccCurve); + + /** + * @brief This function returns pointer to a null terminated string constant which contains the name of the signature scheme (signature algorithm) designated by the input function parameter. + * + * @ingroup Card_Tag_CardFeatures_GeneralPurposeCrypto + * + * @param signatureScheme Signature scheme (signature algorithm) designator. Use values declared in E_SIGNATURE_SCHEMES enumeration. + * + * @return Operation status + */ + c_string DL_API DLGetSignatureSchemeName(uint32_t signatureScheme); + + /** + * @brief Release the memory allocated from some of the library functions previously called making it available again for further allocations. + * + * Use to deallocate i.e. cleanup memory on the heap allocated. This function is a so-called helper for programming languages other than C/C++ where you can use a free(ptr) instead. Use only after calling the library functions for which it is explicitly indicated in this manual. Function returns nothing. After successful function execution ptr will point to NULL. + * + * @ingroup Card_Tag_CardFeatures_CryptoHashAlgorithms + * + * @param ptr Pointer to the memory allocated on the heap which you want to release. If ptr does not point to a block of memory allocated with the library functions, it causes undefined behavior. If ptr is NULL, the function does nothing. Digital signature verification Enumerations, types and structures for use with DigitalSignatureVerifyHash function enum E_ECC_CURVE_DEFINITION_TYPES { ECC_CURVE_INDEX, ECC_CURVE_NAME, ECC_CURVE_DOMAIN_PARAMETERS, ECC_CURVE_DEFINITION_TYPES_NUM }; + * + */ + void DL_API DLFree(void *ptr); + //------------------------------------------------------------------------------ + /** + * @brief Initializes MRTD reader session using MRZ data. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number 9-character document number. + * @param birth_date 6-character birth date in "YYMMDD". + * @param expiry_date 6-character expiry date in "YYMMDD". + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SessionInit(IN const char *doc_number, IN const char *birth_date, IN const char *expiry_date); + + /** + * @brief Reads MRTD document data and returns it in JSON format. + * data includes name, surname, nationality, document number, inmage in base64 and more. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param json_buffer Buffer in which the JSON is stored, recommended size is 8192 mainly because of different possible image formats stored and their size. + * @param json_size Size of the buffer in which the JSON will be stored. Requires initial length to reflect the buffer and to be large enough to store the final JSON. + * On UFR_OK the value will be the actual size of JSON stored. UFR_BUFFER_OVERFLOW indicates that the buffer size was insufficient to store the JSON. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_ReadDocumentData(OUT char *json_buffer, VAR uint32_t *json_size); + + /** + * @brief Closes the MRTD session. This function should be called after MRTD_ReadDocumentData() function. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SessionClose(); + + /** + * @brief Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBac(IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], + VAR uint64_t *send_sequence_cnt); + + /** + * @brief Use this function to read files from the eMRTD NFC tag. + * + * You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param file_index Parameter that specifies the file we want to read from the eMRTD. This is a pointer to byte array containing exactly two bytes designating eMRTD file. Those two bytes are file identificator (FID) and there is a list of FIDs: EF.COM = {0x01, 0x1E} EF.DG1 = {0x01, 0x01} EF.DG2 = {0x01, 0x02} EF.DG3 = {0x01, 0x03} EF.DG4 = {0x01, 0x04} EF.DG5 = {0x01, 0x05} EF.DG6 = {0x01, 0x06} EF.DG7 = {0x01, 0x07} EF.DG8 = {0x01, 0x08} EF.DG9 = {0x01, 0x09} EF.DG10 = {0x01, 0x0A} EF.DG11 = {0x01, 0x0B} EF.DG12 = {0x01, 0x0C} EF.DG13 = {0x01, 0x0D} EF.DG14 = {0x01, 0x0E} EF.DG15 = {0x01, 0x0F} EF.DG16 = {0x01, 0x10} EF.SOD = {0x01, 0x1D} + * @param output After the successful call to this function, this pointer will point to the pointer on the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated during function execution. Maximum amount of data allocated can be 32KB. There is a programmer responsibility to cleanup allocated data (e.g. by calling DLFree(cert) or directly free(cert) from the C/C++ code). + * @param output_length After the successful call to this function, this pointer is pointed to the size of the file data read from an eMRTD file specified by the file_index parameter. + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeap(IN const uint8_t file_index[2], VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Extracts Document Signing (DS) certificate in ASN.1 DER format from SOD. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param[out] cert A pointer to a uint8_t pointer. This will point to the allocated memory containing the + * certificate (ASN.1 DER format). The user is responsible for freeing this memory using DLFree() + * after use. + * @param[out] certlen A pointer to a uint32_t that will store the length of the certificate. + * @param[in] ksenc A uint8_t array of size 16 containing the encryption key. + * @param[in] ksmac A uint8_t array of size 16 containing the MAC key. + * @param[in,out] send_sequence_cnt A pointer to a uint64_t that keeps track of the send sequence counter. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SOD_CertToHeap(VAR uint8_t **cert, VAR uint32_t *certlen, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief This function validates data groups read from the eMRTDocument. + * + * All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function.\ + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidate(IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, uint32_t verbose_level, + OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, you can call this function and pass it null terminated strings containing document number, document holder date of birth and document expiration date. + * + * After successful function execution MRZ Proto Key will be stored in a mrz_proto_key 25-byte array. + * + * @ingroup Card_Tag_CardFeatures_MRTD + * + * @param doc_number Pointer to a null terminated string containing exactly 9 characters document number. + * @param date_of_birth Pointer to a null terminated string containing exactly 6 characters representing the date of birth in the “YYMMDD” format. + * @param date_of_expiry Pointer to a null terminated string containing exactly 6 characters representing expiration date in the “YYMMDD” format. + * @param mrz_proto_key This byte array will contain a calculated MRZ proto-key after successful function execution. This array must have allocated at least 25 bytes prior to calling this function. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_MRZDataToMRZProtoKey(IN const char *doc_number, IN const char *date_of_birth, IN const char *date_of_expiry, + OUT uint8_t mrz_proto_key[25]); + + /** + * @brief In order to get the MRZ Proto Key needed in subsequent steps, in the case of the TD3 MRZ format (88 totally character long), you can call this function and pass it a null terminated string containing the MRZ subjacent row. + * + * Example of the TD3 MRZ format printed on the eMRTD document looks like this: + * P File 2, and overwrites the contents with data provided + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param data Array containing NDEF message data stored in a buffer to be written + * @param data_length length of the data to be written + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFMessage(IN uint8_t *data, uint32_t data_length); + + /** + * @brief Function used to read the whole NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param message pointer to array that will hold message data + * @param message_length length of the message that was read if successfull + * + * @return Operation status + */ + + UFR_STATUS DL_API uFR_int_DesfireReadNDEFMessage(OUT uint8_t *message, uint32_t *message_length); + /** + * @brief Function used to extract the payload of the NDEF message stored on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * @param payload_str pointer to buffer that will hold payload data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadNDEFPayload(OUT char *payload_str); + + /** + * @brief Function used to write the payload of the NDEF message on the Desfire card + * + * @ingroup Card_Tag_Mifare_Desfire + * + * The function takes in only c-string URI, and sets it's uri_identifier to 0 so it is not prefixed by anything when read. + * + * @param payload_str pointer to buffer that will hold message data + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteNDEFPayload(IN c_string payload_str); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief The function allows the blinking of the green diode independently of the user's signaling command (default setting). + * + * This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOn(void); + + /** + * @brief The function prohibits the blinking of the green diode independently of the user's signaling command. + * + * LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOff(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOn(void); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOff(void); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeA(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeB(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Allow user to adjust the value of several registers on PN512. + * + * These are registers: RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefault(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212Default(void); + + /** + * @brief The functions set the factory default settings of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424Default(void); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeA(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeB(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief The functions read the value of the registers RFCfgReg and RxThresholdReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t CWGsNOff, + uint8_t ModGsNOff); + + /** + * @brief Functions allow adjusting values of registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTrans(uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, uint8_t RxGain, + uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief The functions read the value of the registers RFCfgReg, RxThresholdReg, GsNOnReg, GsNOffReg, CWGsPReg, ModGsPReg. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings + * + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTrans(VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, VAR uint8_t *RFLevelAmp, + VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, VAR uint8_t *ModGsNOn, + VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API FastFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheck(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParameters(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrate(OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API GetReaderParametersPN7462(OUT uint8_t *die_id, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, VAR uint8_t *fw_ver_build); + + // SAM + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_raw(OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version(VAR SAM_HW_TYPE *sam_type, OUT uint8_t *sam_uid); + + /** + * @brief Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_raw(uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param key_no key_no + * @param key_v key_v + * @param des_key des_key + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_des(uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * @ingroup UNDOCUMENTED + * + * @param aes_key_ver_a aes_key_ver_a + * @param ver_a ver_a + * @param aes_key_ver_b aes_key_ver_b + * @param ver_b ver_b + * @param aes_key_ver_c aes_key_ver_c + * @param ver_c ver_c + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_key(IN uint8_t *aes_key_ver_a, uint8_t ver_a, IN uint8_t *aes_key_ver_b, + uint8_t ver_b, IN uint8_t *aes_key_ver_c, uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * @ingroup UNDOCUMENTED + * + * @param master_aes_key master_aes_key + * @param key_version key_version + * @param apdu_sw apdu_sw + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_mode(IN uint8_t *master_aes_key, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. + * + * A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plain(IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *keyA, IN uint8_t *keyB, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Ultralight C card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing 2K3DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST containing DES key for authentication to Mifare Desfire card. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 8 bytes of DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_DES_AV2_plain_one_key(uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_key(uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + uint8_t sam_lock_unlock, uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM + * + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKey(uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeable(void); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfReset(void); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOn(void); + + /** + * @brief Function switch off RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderId(IN uint8_t *reader_id); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReader(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderUsb(IN uint8_t *data, uint16_t packet_nr, uint8_t init_cmd, VAR uint8_t *crc_ok); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API ProgReaderStreamUsb(IN uint8_t *data, uint16_t packet_nr); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BootReader(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_CodeProtect(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParams(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_WriteParamsUsb(IN uint8_t *aes_key, IN uint8_t *serial_nr, uint8_t hw_type, uint8_t hw_ver, IN uint8_t *dev_type, uint8_t production); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_Test(uint8_t param); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdCalibration(uint8_t lpcd_threshold, OUT uint16_t *lpcd_reference); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_LpcdPerform(uint8_t lpcd_threshold, uint16_t lpcd_reference, VAR uint16_t *lpcd_agc, VAR uint8_t *lpcd_status); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOff(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_RfOn(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ExtField(void); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API PN7462_ESP32_boot_init(IN uint8_t *reader_cnt, uint8_t reader_nr); + + // MIFARE PLUS + /** + * @brief Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePerso(uint16_t address, IN uint8_t *data); + + /** + * @brief Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPerso(void); + + /** + * @brief Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param card_master_key card_master_key + * @param card_config_key card_config_key + * @param level_2_switch_key level_2_switch_key + * @param level_3_switch_key level_3_switch_key + * @param level_1_auth_key level_1_auth_key + * @param select_vc_key select_vc_key + * @param prox_chk_key prox_chk_key + * @param vc_poll_enc_key vc_poll_enc_key + * @param vc_poll_mac_key vc_poll_mac_key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimal(IN uint8_t *card_master_key, IN uint8_t *card_config_key, IN uint8_t *level_2_switch_key, + IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, IN uint8_t *select_vc_key, + IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key); + + /** + * @brief Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1(uint8_t key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PK(IN uint8_t *aes_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current master key *new key pointer to 16 byte array containing the new master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current master key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new master key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey(uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PK(IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index key index from which the new configuration key will be set (0 - 15) or in SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKey(uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) *configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PK(IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKey(uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Key B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B auth_mode_pk MIFARE_PLUS_AES_AUTHENT1A for Key A or MIFARE_PLUS_AES_AUTHENT1B for Key B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param key_index key_index + * @param new_key_index new_key_index + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKey(uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, uint8_t new_key_index, uint8_t new_key_type); + + /** + * @brief + * ADD DESCRIPTION + * @ingroup Card_Tag_Mifare_Plus + * @ingroup UNDOCUMENTED + * + * @param sector_nr sector_nr + * @param auth_mode auth_mode + * @param old_key old_key + * @param new_key new_key + * @param new_key_type new_key_type + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PK(uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, uint8_t new_key_type); + + /** + * @brief Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key_index_vc_poll_enc_key ordinary number of VC polling ENC key stored into reader (0 - 15) + * @param key_index_vc_poll_mac_key ordinary number of VC polling MAC key stored into reader (0 - 15) + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKey(uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PK(IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey(uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key_index pointer to 16 byte array containing card configuration key + * @param new_key_index pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKey(uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief + * Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PK(IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief + * Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Mifare_Plus + * + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PK(IN uint8_t *key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * @brief No authentication. Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth_internal(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key_internal(IN uint8_t *new_3des_key); + + /** + * @brief Write key into the card. + * + * @ingroup Card_Tag_Ultralight_C + * + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_internal(IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceGet(uint32_t auth_mode, IN void *auth_value, VAR int32_t *credit); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API BalanceSet(uint32_t auth_mode, IN void *auth_value, int32_t credit); + + /** + * @brief This function sets communication speed (UART baud rate). + * + * Allowed values of baud rate are: 9600, 19200, 38400, 57600, 115200, 230400, 460800, 500000, and 1000000 bps. All RS232 devices are supported, and USB devices (Nano FR, Classic) from firmware version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param baud_rate UART baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API SetUartSpeed(uint32_t baud_rate); + + /** + * @brief This function returns communication speed (UART baud rate) to default value. + * + * For RS23 devices default communication speed is 115200 bps, and for USB devices is 1000000 bps. + * For RS232 devices from version 5.0.1 (plus devices), and for USB devices from version 5.0.31. + * + * @ingroup ReaderAndLibrary_Communication + * + * @param reader_type 1 - USB 2 - RS232 + * @param comm_type 1 - COM port 2 - FTDI + * @param port_name If comm_type is FTDI enter empty string If comm_type is COM port Windows “COMx” Linux “/dev/ttyUSBx” Mac OS “/dev/tty.usbserial-xxxxxxxx” + * + * @return Operation status + */ + UFR_STATUS DL_API SetDefaultUartSpeed(uint8_t reader_type, uint8_t comm_type, IN c_string port_name); + + // NT4H + /** + * @brief Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. + * + * This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parameters(uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Provided Key mode (PK) The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief The function changes the access parameters of an existing standard data file. + * + * The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit read_ctr_limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Provided Key mode (PK) Function enables card Random ID. + * + * Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pk(IN uint8_t *aes_key_ext); + UFR_STATUS DL_API nt4h_unset_rid_pk(IN uint8_t *aes_key_ext); + + /** + * @brief Function enables card Random ID. Authentication with application master key (key number 0) required. + * + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid(uint8_t aes_key_no); + + /** + * @brief Provided Key mode (PK) Function returns card UID if Random ID activated. + * + * Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no ordinal number of AES key into reader (0 - 15) + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid(uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Provided Key mode (PK) Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pk(IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Function changes AES key. + * + * Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key(uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Provided Key mode (PK) Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pk(IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr(uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief No authentication. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_auth(uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Helper function for the MAC of SDM checking. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param mac_in_data data from mac_input_offset to mac_offset + * @param mac_in_len mac_input_offset - mac_offset + * @param sdm_mac pointer to array contained 8 bytes SDM MAC + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_check_sdm_mac(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *mac_in_data, IN uint8_t mac_in_len, IN uint8_t *sdm_mac); + + /** + * @brief Helper function for decryption of encrypted file data. + * + * Users need to know the SDM counter, UID and AES key for file data read. + * + * @ingroup Card_Tag_NT4H + * + * @param smd_read_counter value of SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param auth_key pointer to array contained AES meta data read key + * @param enc_file_data pointer to array contained encrypted part of file data + * @param enc_file_data_len length of encrypted part of file data + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_sdm_enc_file_data(uint32_t smd_read_counter, IN uint8_t *uid, IN uint8_t *auth_key, IN uint8_t *enc_file_data, IN uint8_t enc_file_data_len); + + /** + * @brief Helper function for decryption of encrypted PICC data. + * + * Function returns UID and SDM reading counter. Users need to know the AES key for metadata read (PICC data). + * + * @ingroup Card_Tag_NT4H + * + * @param picc_data pointer to array contained encrypted PICC data + * @param auth_key pointer to array contained AES meta data read key + * @param picc_data_tag if bit 7 set exist UID mirroring if bit 6 set exist SDM reading counter + * @param uid pointer to array contained 7 bytes UID + * @param smd_read_cnt pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_decrypt_picc_data(IN uint8_t *picc_data, IN uint8_t *auth_key, IN uint8_t *picc_data_tag, IN uint8_t *uid, IN uint32_t *smd_read_cnt); + + /** + * Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. + * + * Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * @brief Function returns file settings. + * + * @ingroup Card_Tag_NT4H + * + * @param file_no 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pk(IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H + * + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature(uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pk(IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status(uint8_t aes_key_no, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H + * + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_auth(VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_ext ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pk(IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H + * + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt(uint8_t aes_key_no, uint8_t tt_status_key_no); + + // Desfire light + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param file_type file type 0 - standard data file, 2 - value file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param free_get_value value file get value without authentication (0 - disabled, 1 - enabled) + * @param record_size cyclic record file size of record + * @param max_number_of_rec cyclic record file maximal number of record + * @param curr_number_of_rec cyclic record file number of used record + * @param ex_unauth_operation TMC file exclude unauthorized operation + * @param tmc_limit_conf TMC file limit configuration + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param tmc_limit TMC file counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_get_file_settings(uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, VAR uint8_t *free_get_value, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *ex_unauth_operation, VAR uint8_t *tmc_limit_conf, VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, VAR uint32_t *tmc_limit); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered read_key_no read key number (0 - 4) write_key_no write key number (0 - 4) read_write_key_no read write key number (0 - 4) change_key_no change key number (0 - 4) + * @param key_no DESCRIPTION + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no currnent change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Function changes file settings of the Transaction MAC file. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no aes_key_no + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings(uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * @ingroup UNDOCUMENTED + * + * @param aes_key_ext aes_key_ext + * @param file_no file_no + * @param key_no key_no + * @param curr_communication_mode curr_communication_mode + * @param new_communication_mode new_communication_mode + * @param read_key_no read_key_no + * @param commit_reader_id_key_no commit_reader_id_key_no + * @param change_key_no change_key_no + * @param ex_unauth_operation ex_unauth_operation + * @param tmc_limit_conf tmc_limit_conf + * @param tmc_limit tmc_limit + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_tmc_file_settings_pk(IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t ex_unauth_operation, uint8_t tmc_limit_conf, uint32_t tmc_limit); + + /** + * @brief + * From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pk(IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file(uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in credit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of credit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_credit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in debit value operation. Function also returns decrypted Previous Reader ID. User must enter file number, value of credit, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param value value of debit + * @param trans_mac_counter transaction MAC counter uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param uid pointer to 7 bytes array containing card UID trans_mac_key pointer to 16 bytes array containing Transaction MAC key reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_debit_value_transaction_mac(uint8_t file_no, uint32_t value, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in write record operation. Function also returns decrypted Previous Reader ID. User must enter file number, data offset, data length, array of data, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param offset data offset + * @param data_len length of array of data + * @param data pointer to data array + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_check_write_record_transaction_mac(uint8_t file_no, uint32_t offset, uint32_t data_len, IN uint8_t *data, uint32_t trans_mac_counter, + IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + /** + * @brief From library version 5.0.37 and firmware version 5.0.38. For Desfire Light, and Desfire EV2. + * Helper function for check transaction MAC in clear record operation. Function also returns decrypted Previous Reader ID. Users must enter file number, transaction MAC counter, card UID, transaction MAC key, Reader ID, encrypted Previous Reader ID and transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_Light + * + * @param file_no file number + * @param trans_mac_counter transaction MAC counter + * @param uid pointer to 7 bytes array containing card UID + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param reader_id pointer to 16 bytes array containing Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing Previous Encrypted Reader ID + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * @param prev_reader_id pointer to 16 bytes array containing Previous Reader ID + * + * @return Operation status + */ + UFR_STATUS DL_API desfire_check_clear_record_transaction_mac(uint8_t file_no, uint32_t trans_mac_counter, IN uint8_t *uid, IN uint8_t *trans_mac_key, + IN uint8_t *reader_id, IN uint8_t *prev_enc_reader_id, IN uint8_t *trans_mac_value, OUT uint8_t *prev_reader_id); + + // reader + /** + * @brief Function returns various reader states. + * + * From library version 5.0.31 and firmware version 5.0.33 + * The reader states are defined into following structures. This function is useful for checking if the reader is still in emulation mode after calling the TagEmulationStartRam() function. + * typedef enum E_EMULATION_MODES { + * TAG_EMU_DISABLED, + * TAG_EMU_DEDICATED, + * TAG_EMU_COMBINED, + * TAG_EMU_AUTO_AD_HOC + * }emul_modes_t; + * typedef enum E_EMULATION_STATES + * { + * EMULATION_NONE, + * EMULATION_IDLE, + * EMULATION_AUTO_COLL, + * EMULATION_ACTIVE, + * EMULATION_HALT, + * EMULATION_POWER_OFF + * }emul_states_t; + * typedef enum E_PCD_MGR_STATES + * { + * PCD_MGR_NO_RF_GENERATED, + * PCD_MGR_14443A_POLLING, + * PCD_MGR_14443A_SELECTED, + * PCD_MGR_CE_DEDICATED, + * PCD_MGR_CE_COMBO_START, + * PCD_MGR_CE_COMBO, + * PCD_MGR_CE_COMBO_IN_FIELD + * }pcd_states_t; + * + * @ingroup Miscellaneous + * + * @param state - normal working mode states are PCD_MGR_NO_RF_GENERATED or PCD_MGR_14443A_POLLING or PCD_MGR_14443A_SELECTED. - NTAG emulation mode state is PCD_MGR_CE_DEDICATED emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_mode - normal working mode state is TAG_EMU_DISABLED - NTAG emulation mode state is TAG_EMU_DEDICATED emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param emul_state state from structure emul_states_t sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * @param sleep_mode 0 - reader is in normal or emulation mode 1 - reader is in sleep mode + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderStatus(VAR pcd_states_t *state, VAR emul_modes_t *emul_mode, VAR emul_states_t *emul_state, VAR uint8_t *sleep_mode); + + // EMV FUNCTIONS + + /** + * @brief Used for extracting the credit card PAN number. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param pan_str Pointer to char array containing credit card PAN. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetPAN(IN c_string df_name, OUT char *pan_str); + + /** + * @brief Used for extracting details about the last transaction stored in a credit card. Must provide card’s Payment System Environment (PSE1 or PSE2). + * + * @ingroup Card_Tag_CardFeatures_EMV + * + * @param df_name Name of Payment System Environment used. Use value “1PAY.SYS.DDF01” for PSE1, or “2PAY.SYS.DDF01” for PSE2 + * @param last_transaction_info Pointer to char array containing details about the last transaction stored in the card. + * + * @return Operation status + */ + UFR_STATUS DL_API EMV_GetLastTransaction(IN c_string df_name, OUT char *last_transaction_info); + + + /** + * @brief Function is used for extracting image pixel values and storing them in the display for later use. This function will not render the image to the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param gallery_index - where in displays memory to store the bitmap(0-10) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveBitmapToGallery(const char *filename, int gallery_index); + + /** + * @brief Function takes an image and extracts it's pixel values and then just renders the on the display without storing the bitmap in the display + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param timeout - how long the bitmap should stay on display, 0-is indefinitely + * @param positionX - where on the display to start the bitmap. + * @param positionY - where on the display to start the bitmap. + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmap(const char *filename, uint32_t timeout, int positionX, int positionY); + + /** + * @brief Function renders an image that is stored in the display gallery. The gallery consist of 15 slots, of those 15 - 10 are used for storing bitmaps and the other 4 (11-15) are SystemBitmaps used by the display. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param gallery_index - which slot from the gallery to render on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowBitmapFromGallery(int gallery_index); + + /** + * @brief Function allows you to change the essential symbols that the display regularly uses. These symbols include the Boot Image (ID-15), the Check bitmap(ID-14), and the Cross bitmap (ID-13). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param filename - pointer to the image + * @param system_bitmap_index - ID of which system bitmap to change or import new (if slot is free 11-12) + * @return Operation status + */ + UFR_STATUS DL_API Display_SaveSystemBitmap(const char *filename, int system_bitmap_index); + + /** + * @brief Function renders the last image that was called with the function Display_ShowBitmap() + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowLastUnsavedImage(); + + /** + * @brief Function is used for communicating with the uFR device via I2C in COM protocol format. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param cmd - Command packet (read the "COM protocol" for more information) + * @param cmd_ext - Command extended packet, if cmd_ext is not being sent then should be "NULL" + * @param rsp - Array where the response will be written (at least 7 bytes) + * @return Operation status + */ + UFR_STATUS DL_API Display_Transmit(uint8_t *cmd, uint8_t *cmd_ext, uint8_t *rsp); + + /** + * @brief Function displays custom text on the screen. It can also enable text scrolling, position the text at a specific location on the display, and adjust the font size and style + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param customText - pointer to a string text + * @param fontStyle - number to change font style (0-1; 0 - default; 1 - not implemented) + * @param fontSize - number to change font size (0-1; 0 - 8x8 pixels; 1 - 16x16 pixels) + * @param scrollEnable - number to enable scroll (0-1) + * @param positionX - number containing X cordinate to place the text + * @param positionY - number containing Y cordinate to place the text + * @return Operation status + */ + UFR_STATUS DL_API Display_PrintText(const char *customText, int fontStyle, int fontSize, int scrollEnable, int positionX, int positionY); + + /** + * @brief Function displays a chec or a cross bitmap and, if a speaker is connected to the display, it triggers a function that produces a beep sound + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param signal - number to display a check or a cross symbol on the display (1-2; 1-cross; 2-check) + * @return Operation status + */ + UFR_STATUS DL_API Display_UserInterfaceSignal(int signal); + + /** + * @brief Function writes the time on the display. If the display is not connected to the Reader, the time will be displayed and remain unchanged. However, if the display is connected to the Reader, the time will be shown only for a second because the Reader is sending the correct time to the display every second. + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param hour - number that represents the hour that will be drawn on the display + * @param minute - number that represents the minute that will be drawn on the display + * @return Operation status + */ + UFR_STATUS DL_API Display_ShowTime(int hour, int minute); + + /** + * @brief Function clears a specified section of the display. If xPosEND or yPosEND are set to 0, the function will automatically assume that the end postion for erasing extends to the edge of the screen (i.e., xPosEND will default to the display's maximum width, and yPosEND will default to it's maximum height). + * @since uFCoder library version 6.0.5 + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_DisplayControl + * @param xPos - number containing X coordinate to clear on the display, start position + * @param xPosEND - number containing X coordinate to clear on the display, end position + * @param yPos - number containing Y coordinate to clear on the display, start position + * @param yPosEND - number containing Y coordinate to clear on the display, end position + * @return Operation status + */ + UFR_STATUS DL_API Display_EraseSection(int xPos, int xPosEND, int yPos, int yPosEND); + + /** + * @brief Function sets service data into EEPROM. Only use with production firmware. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param data pointer to array of 5 bytes which contains new service data + * @return Operation status + */ + UFR_STATUS DL_API SetServiceData(IN uint8_t *data); + + /** + * @brief Function gets service data from EEPROM. Use in diagnostic tool. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param data pointer to array which contains service data + * @return Operation status + */ + UFR_STATUS DL_API GetServiceData(OUT uint8_t *data); + + /** + * @brief Function gets number and types of the installed I2C devices at the reader + * @since uFCoder library version 6.0.18 + * + * @ingroup INTERNAL + * @param dev_num number of I2C devices found + * @param dev_bits bit array that represents types of I2C devices + * @return Operation status + */ + UFR_STATUS DL_API GetI2cDevicesStatus(uint8_t *dev_num, uint32_t *dev_bits); + + /** + * @brief Function gets lock status of the reader + * @since uFCoder library version 6.0.19 + * + * @ingroup INTERNAL + * @param lock_status + * @return Operation status + */ + UFR_STATUS DL_API GetReaderLockStatus(uint8_t *lock_status); + + /** + * @brief Function changes password at the NXP ICODE cards (provided passwords) + * @since uFCoder library version 6.0.13 + * + * @ingrup + * @param pwd_ident - Password Identifier + * @param current_password - pointer to the 4 bytes array that represents current password + * @param new_password - pointer to the 4 bytes array that represents new password + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password_PK(uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); + + /** + * @brief Function changes password at the NXP ICODE cards (reader's passwords) + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param pwd_ident - Password Identifier + * @param current_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @param new_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password(uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page_PK(IN uint8_t *read_password, IN uint8_t *write_password, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page(uint8_t read_pass_index, uint8_t write_pass_index, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function locks permanently the requested block on the ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API iso15693_lock_block_no_auth(uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block_PK(IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block(uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); + + /** + * @brief Function read the security status of the blocks from ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param first_block - address of the first block for security status reading + * @param number_of_blocks - number of blocks for security status reading + * @param block_data - pointer to the array of blocks security status (1 - block locked, 0 - block not locked). + * @return Operation status + */ + UFR_STATUS DL_API iso15693_get_multiply_block_security_status(uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + // XXX: Support for multiple readers with same DLL + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ################# M U L T I R E A D E R S U P P O R T ################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + // ############################################################################# + + //-------------------------------------------------------------------------------------------------- + + ///--------------------------------------------------------------------- + /** + * @brief This is the first function in the order for execution for the multi-reader support. + * The function prepares the list of connected uF-readers to the system and returns the number of list items - number of connected uFR devices. + * ReaderList_UpdateAndGetCount() scans all communication ports for compatible devices, probes open readers if still connected, if not close and marks their handles for deletion. If some device is disconnected from the system this function should remove its handle. + * As of uFCoder version 5.0.73, this function probes both FTDI & COM devices and tries to open them. + * Each call to this method will close previously opened devices by this function, scan, and open everything found. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param NumberOfDevices how many compatible devices are connected to the system + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_UpdateAndGetCount(VAR int32_t *NumberOfDevices); + + /** + * @brief Used to retrieve information about a reader found & connected via ReaderList_UpdateAndGetCount(). + * This should be executed for each device based on number of devices found, providing valid index. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex index of the device in the readers list + * @param DeviceHandle assigned Handle + * @param DeviceSerialNumber device serial number + * @param DeviceType device type - device identification in AIS database + * @param DeviceFWver version of firmware + * @param DeviceCommID device identification number (master) + * @param DeviceCommSpeed communication speed + * @param DeviceCommFTDISerial FTDI COM port identification + * @param DeviceCommFTDIDescription FTDI COM port description + * @param DeviceIsOpened is Device opened + * @param DeviceStatus actual device status + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetInformation( // + uint32_t DeviceIndex, // index of the device to get information from + VAR UFR_HANDLE *DeviceHandle, //// assigned Handle + OUT c_string *DeviceSerialNumber, //// device serial number + VAR int *DeviceType, //// device type - device identification in AIS database + OUT c_string *DeviceFWver, //// version of firmware + VAR int *DeviceCommID, //// device identification number (master) + VAR int *DeviceCommSpeed, //// communication speed + OUT c_string *DeviceCommFTDISerial, //// FTDI COM port identification + OUT c_string *DeviceCommFTDIDescription, //// FTDI COM port description + VAR int *DeviceIsOpened, //// is Device opened + VAR int *DeviceStatus //// actual device status + ); + + /** + * @brief Force handle deletion when you identify that the reader is no longer connected, and want to release the handle immediately. If the handle exists in the list of opened devices, function would try to close communication port and destroy the handle. + * When uFR reader is disconnected, ReaderList_UpdateAndGetCount() will do that (destroy) automatically in next execution. + * + * @param DeviceHandle The handle that will be destroyed + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Destroy(UFR_HANDLE *DeviceHandle); + + /** + * @brief This method is used for manual addition of uFR devices to the list. Parameters used are the same as in ReaderOpenEx() method. Use this method if the device was not previously discovered by the ReaderList_UpdateAndGetCount() method. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceHandle the handle that will be assigned for interacting with the specified reader on success. + * @param reader_type Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_name Refer to ReaderOpenEx() for detailed description of this parameter. + * @param port_interface Refer to ReaderOpenEx() for detailed description of this parameter. arg Refer to ReaderOpenEx() for detailed description of this parameter. + * @param arg Refer to ReaderOpenEx() for detailed description of this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_Add(UFR_HANDLE *DeviceHandle, uint32_t reader_type, + c_string port_name, uint32_t port_interface, void *arg); + + /** + * @brief Tries to re-open the device based on the serial number of the device. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param hndUFR handle of the uFR device + * @param Device_SN Serial number of the device contained as char array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenBySerial(VAR UFR_HANDLE *hndUFR, const char Device_SN[16]); + + // XXX: Obsolete functions - remain for backward compatibility + /** + * @brief + * Gets reader’s reader serial number as a pointer to 4 byte value, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulSerialNumber Contains reader serial number as a 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialByIndex(int32_t DeviceIndex, VAR uint32_t *lpulSerialNumber); + + /** + * @brief Gets reader’s descriptive name as a array of 8 chars, based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param pSerialDescription Contains reader serial number as array of 8 chars + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetSerialDescriptionByIndex(int32_t DeviceIndex, OUT uint8_t pSerialDescription[8]); + + /** + * @brief Gets devices reader type based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param lpulReaderType Contains reader type as 4 byte value (uint32_t) + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetTypeByIndex(int32_t DeviceIndex, VAR uint32_t *lpulReaderType); + + /** + * @brief Gets devices FTDI serial port number based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Serial Contains FTDI serial number as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDISerialByIndex(int32_t DeviceIndex, OUT char **Device_Serial); + + /** + * @brief Gets devices FTDI description based on the index of the device in the list. + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param Device_Description FTDI description as c_string + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_GetFTDIDescriptionByIndex(int32_t DeviceIndex, OUT char **Device_Description); + + /** + * @brief Tries to re-open the device based on the device index. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount(). + * + * @ingroup ReaderAndLibrary_ReaderList + * + * @param DeviceIndex Index of the device + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderList_OpenByIndex(const int32_t DeviceIndex, VAR UFR_HANDLE *hndUFR); + + //-------------------------------------------------------------------------------------------------- + + // open first/next Reader and return handle - better to use ReaderList_OpenByIndex() + /** + * @brief Multi reader support. Open reader communication port for all µFR devices. You can also use this function to open communication with µFR Online devices. + * Using ReaderOpen to open communication with µFR Online devices: + * If you have only one reader attached to your PC, it will open that reader serial port on 1Mbit/s, or if you have only one reader attached to another power supply (not your PC) it will open that reader based on it’s working mode (TCP or UDP). If you have more than one µFR Online device, ReaderOpen function will open the first one found, for opening another device, use ReaderOpenEx instead. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderOpenM(VAR UFR_HANDLE *hndUFR); + +#ifdef ESP_PLATFORM + /** + * @brief @param hndUFR handle of the uFR device + * @param port_num + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderOpenM(VAR UFR_HANDLE *hndUFR, uint32_t port_num); +#endif + + /** + * @brief Multi reader support. Physical reset of reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Close reader communication port. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderCloseM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function is used to restart the reader by software. It sets all readers parameters to default values and close RF field which resets all the cards in the field. + * + * @ingroup ReaderAndLibrary_Communication_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoftRestartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Returns reader type as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulReaderType pointer to lpulReaderType variable. “lpulReaderType” as result - please refer to Appendix: DLogic reader type enumeration. E.g. for µFR Nano Classic readers this value is 0xD1180022. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTypeM(UFR_HANDLE hndUFR, OUT uint32_t *lpulReaderType); + + /** + * @brief Multi reader support. Returns reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialNumberM(UFR_HANDLE hndUFR, OUT uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Retrieve info if reader is still connected to host. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param connected pointer to connected variable “connected” as result: > 0 Reader is connected on system = 0 Reader is not connected on system anymore (or closed) < 0 other error “connected” - Pointer to unsigned int type variable 32 bit long, where the information about readers availability is written. If the reader is connected on system, function store 1 (true) otherwise, on some error, store zero in that variable. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderStillConnectedM(UFR_HANDLE hndUFR, VAR uint32_t *connected); + + /** + * @brief Multi reader support. Store a new key or change existing key under provided index parameter.The keys are in a special area in EEPROM that can not be read anymore which gains protection. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucKey Pointer to an array of 6 bytes containing the key. Default key values are always “FF FF FF FF FF FF” hex. + * @param ucKeyIndex key Index. Possible values ​​are 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeyWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucKey, uint8_t ucKeyIndex); + + /** + * @brief Multi reader support. Lock reader’s keys to prevent further changing. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysLockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. Unlock reader’s keys if they are locked with previous function. + * The factory setting is that reader keys are unlocked. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing valid password. + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderKeysUnlockM(UFR_HANDLE hndUFR, IN const uint8_t *password); + + /** + * @brief Multi reader support. This function turns sound and light reader signals. Sound signals are performed by the reader's buzzer and light signals are performed by the reader's LEDs. + * There are predefined signal values for sound and light: + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_signal_mode 0 - None, 1 - Long Green, 2 - Long Red, 3 - Alternation, 4 - Flash + * @param beep_signal_mode 0 - None, 1 - Short, 2 - Long, 3 - Double Short, 4 - Triple Short, 5 - Triplet Melody + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderUISignalM(UFR_HANDLE hndUFR, uint8_t light_signal_mode, uint8_t beep_signal_mode); + + /** + * @brief Multi reader support. From version 5.0.68. + * Function sets the duty cycle ratio of the sound signal. Value is in percent (0 - 100%). Default value is 50%, and this value will be set after the reset of the reader, without using this function. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param sound_volume volume in percent 0 - 100 % + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderSoundVolumeM(UFR_HANDLE hndUFR, uint8_t sound_volume); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Read user data written in device NV memory. + * User data is 16 byte long. + * From version 5.0.86. function ReadUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 bytes array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API ReadUserDataExtM(UFR_HANDLE hndUFR, OUT uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Write user data into the device's NV memory. User data is 16 byte long. + * From version 5.0.86. function WriteUserDataExt added. When using this function, user data is 32 bytes long. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param aucData pointer to a 16 byte array containing user data, or 32 bytes for ReadUserDataExt + * + * @return Operation status + */ + UFR_STATUS DL_API WriteUserDataExtM(UFR_HANDLE hndUFR, IN const uint8_t *aucData); + + /** + * @brief Multi reader support. Returns card UID as a 4-byte array. This function is deprecated and used only for backward compatibility with older firmware versions (before v2.0). We strongly discourage use of this function. This function can’t successfully handle 7 byte UIDS. + * + * @param hndUFR handle of the uFR device + * @param lpucCardType returns pointer to variable which holds card type according to SAK lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * @param lpulCardSerial returns pointer to array of card UID bytes, 4 bytes long ONLY + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType, OUT uint32_t *lpulCardSerial); + + /** + * @brief Function returns ATQA and SAK (ISO 14443-3) of selected card. + * + * Multi reader support. From library version 5.0.36 and firmware version 5.0.37 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param atqa pointer to variable which contain ATQA sak pointer to variable which contain SAK + * @param sak pointer to variable which contain SAK + * + * @return Operation status + */ + UFR_STATUS DL_API GetAtqaSakM(UFR_HANDLE hndUFR, uint16_t *atqa, uint8_t *sak); + + /** + * @brief Multi reader support. Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.28) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authenticationwith key A or key B:use KeyA - MIFARE_AUTHENT1A = 0x60or KeyB - MIFARE_AUTHENT1B = 0x61For NTAG 21x, Ultralight EV1 and other T2T tags supportingPWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead()or LinearRead_PK() functions. Value 0x60 with LinearRead() orLinearRead_PK() functions means “without PWD_AUTH“ and in thatcase you can send for ucReaderKeyIndex or aucProvidedKeyparameters anything you want without influence on the result. ForNTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTHyou can use _AKM1 or _AKM2 function variants only withoutPWD_AUTH in any case of the valid values (0x60 or 0x61) providedfor this parameter.For Mifare Plus tags (PK mode) defines whether to performauthentication with key A or key B:use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearReadSamKeyM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start reading + * @param usDataLength Length of data - how many bytes to read + * @param lpusBytesReturned Pointer to variable holding how many bytes are returned + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowReadM(UFR_HANDLE hndUFR, OUT uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesReturned, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param aucData Pointer to array of bytes containing data + * @param usLinearAddress Address of byte - where to start writting + * @param usDataLength Length of data - how many bytes to write + * @param lpusBytesWritten Pointer to variable holding how many bytes were written + * @param ucKeyMode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param ucReaderKeyIndex Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearWriteSamKeyM(UFR_HANDLE hndUFR, IN const uint8_t *aucData, uint16_t usLinearAddress, uint16_t usDataLength, + VAR uint16_t *lpusBytesWritten, uint8_t ucKeyMode, uint8_t ucReaderKeyIndex); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCardM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteSamKeyM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key_index Index of reader’s key to be used (RK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafeM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *sector_trailer, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorReadSamKeyM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWriteSamKeyM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrementSamKeyM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + uint8_t key_index); + + /** + * @brief Multi reader support. Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key_index Index of reader’s key to be used (RK mode)For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrementSamKeyM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, uint8_t key_index); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM1M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters + + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM1M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM1M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM1M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM1M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM1M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented sector_address Absolute Sector address block_in_sector_address Block address in Sector auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 1 (AKM1) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM1M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) For keys into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.29 and library versions from 5.0.19. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read bytes_returned + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_AKM2M(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write bytes_returned + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_AKM2M(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_AKM2M(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_AKM2M(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) ValueBlockDecrement Function description Decrements particular Value block with specified value using absolute Block address. Mifare Plus X, SE and EV1 using. For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. Function declaration (C language) UFR_STATUS ValueBlockDecrement(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); UFR_STATUS ValueBlockDecrement_AKM1(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode; UFR_STATUS ValueBlockDecrement_AKM2(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); UFR_STATUS ValueBlockDecrement_PK(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, const uint8_t *key); *only uFR CS with SAM support UFR_STATUS ValueBlockDecrementSamKey(int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, uint8_t key_index); + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_AKM2M(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_AKM2M(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Automatic Key Mode 2 (AKM2) + * Decrements particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_AKM2M(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using absolute Block address. + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockRead() or BlockRead_PK() functions. Value 0x60 with BlockRead() or BlockRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API BlockRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using absolute Block address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param block_address Absolute block address + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockWrite() or BlockWrite_PK() functions. Value 0x60 with BlockWrite() or BlockWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t block_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorRead() or BlockInSectorRead_PK() functions. Value 0x60 with BlockInSectorRead() or BlockInSectorRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular block using relative Block in Sector address. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with BlockInSectorWrite() or BlockInSectorWrite_PK() functions. Value 0x60 with BlockInSectorWrite() or BlockInSectorWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API BlockInSectorWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint8_t sector_address, uint8_t block_in_sector_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearRead() or LinearRead_PK() functions. Value 0x60 with LinearRead() or LinearRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read Linear data Address Space. On the contrary of LinearRead functions, this functions read whole card including trailer blocks and manufacturer block. + * This function is useful when making “dump” of the whole card. + * Linear reading in uFR firmware utilise FAST_READ ISO 14443-3 command with NTAG21x and Mifare Ultralight EV1 tags. When using this functions with other card types, auth_mode, key_index and key parameters are not relevant but must take default values. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start reading + * @param length Length of data - how many bytes to read + * @param bytes_returned Pointer to variable holding how many bytes are returned + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinRowRead() or LinRowRead_PK() functions. Value 0x60 with LinRowRead() or LinRowRead_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinRowRead_PKM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_returned, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * These functions are used for writing data to the card using emulation of the linear address space. The method for proving authenticity is determined by the suffix in the functions names. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param data Pointer to array of bytes containing data + * @param linear_address Address of byte - where to start writing + * @param length Length of data - how many bytes to write + * @param bytes_written Pointer to variable holding how many bytes were written + * @param auth_mode For Mifare Classic tags defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH value 0x61 means “use PWD_AUTH“ with LinearWrite() or LinearWrite_PK() functions. Value 0x60 with LinearWrite() or LinearWrite_PK() functions means “without PWD_AUTH“ and in that case you can send for ucReaderKeyIndex or aucProvidedKey parameters anything you want without influence on the result. For NTAG 21x, Ultralight EV1 and other T2T tags supporting PWD_AUTH you can use _AKM1 or _AKM2 function variants only without PWD_AUTH in any case of the valid values (0x60 or 0x61) provided for this parameter. For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 bytes array containing Crypto1 key (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearWrite_PKM(UFR_HANDLE hndUFR, IN const uint8_t *data, uint16_t linear_address, uint16_t length, + VAR uint16_t *bytes_written, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It performs “Format card” operation - write new Sector Trailer values on whole card at once. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Bytes 0 - 5 + * Bytes 6 - 8 + * Byte 9 + * Bytes 10 - 15 + * KeyA + * Block Access & + * Trailer Access Bits + * GPB + * KeyB + * For more information, please refer to Mifare Classic Keys and Access Conditions in this document. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authetntication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are caluculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provode to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param blocks_access_bits Block Access permissions bits. Values 0 to 7 + * @param sector_trailers_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailers_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyA + * @param lpucSectorsFormatted Pointer to variable holding return value how many sectors are successfully formatted + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API LinearFormatCard_PKM(UFR_HANDLE hndUFR, IN const uint8_t *new_key_A, uint8_t blocks_access_bits, + uint8_t sector_trailers_access_bits, uint8_t sector_trailers_byte9, IN const uint8_t *new_key_B, + VAR uint8_t *lpucSectorsFormatted, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Mifare Plus using. + * For firmware versions from 5.0.29 and library versions from 5.0.19, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculated from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param new_key_A Pointer on 6 bytes array containing a new KeyA + * @param block0_access_bits Access Permissions Bits for Block 0. Values 0 to 7 + * @param block1_access_bits Access Permissions Bits for Block 1. Values 0 to 7 + * @param block2_access_bits Access Permissions Bits for Block 2. Values 0 to 7 + * @param sector_trailer_access_bits Sector Trailer Access permissions bits. Values 0 to 7 + * @param sector_trailer_byte9 GPB value + * @param new_key_B Pointer on 6 bytes array containing a new KeyB + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWrite_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, IN const uint8_t *new_key_A, + uint8_t block0_access_bits, uint8_t block1_access_bits, uint8_t block2_access_bits, + uint8_t sector_trailer_access_bits, uint8_t sector_trailer_byte9, IN const uint8_t *new_key_B, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is specific to Mifare Classic cards only. It writes new Sector Trailer value at one Sector Trailer. It writes following data: + * KeyA, Block Access Bits, Trailer Access Bits, GeneralPurposeByte(GPB), KeyB, same as construction of Sector Trailer. + * Difference between this function and SectorTrailerWrite is : + * * SectorTrailerWrite will check parameters and “safely” write them into trailer, non valid values will not be written + * * SectorTrailerWriteUnsafe writes array of 16 bytes as raw binary trailer representation, any value can be written. + * USE THIS FUNCTION WITH CAUTION, WRONG VALUES CAN DESTROY CARD! + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param addressing_mode Defines if Absolute (0) or Relative (1) Block Addressing mode is used + * @param address Address of Trailer according to addressing_mode + * @param sector_trailer Pointer to 16 byte array as binary representation of Sector Trailer + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 + * @param key Pointer to 6 byte array containing key bytes (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API SectorTrailerWriteUnsafe_PKM(UFR_HANDLE hndUFR, uint8_t addressing_mode, uint8_t address, + IN const uint8_t *sector_trailer, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t block_address, + uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Read particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of reading value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorRead_PKM(UFR_HANDLE hndUFR, VAR int32_t *value, VAR uint8_t *value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Write particular Value block using absolute Block address. This function uses Mifare Classic specific mechanism of writing value which is stored into whole block. Value blocks have a fixed data format which permits error detection and correction and a backup management. Value is a signed 4-byte value and it is stored three times, twice non-inverted and once inverted. Negative numbers are stored in standard 2's complement format. For more info, please refer to Mifare Classic documentation. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to variable where retrieved value will be stored + * @param value_addr Signifies a 1-byte address, which can be used to save the storage address of a block, when implementing a powerful backup management. For more info, please refer to Mifare Classic documentation. + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorWrite_PKM(UFR_HANDLE hndUFR, int32_t value, uint8_t value_addr, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value value showing how much initial block value will be incremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Increments particular Value block with specified value using Block in Sector address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param increment_value increment value to add + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorIncrement_PKM(UFR_HANDLE hndUFR, int32_t increment_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Decrements particular Value block with specified value using absolute Block address. + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param block_address Absolute block address + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 key_index Index of reader’s key to be used (RK mode) For Crypto1 keys (0 - 31) For Mifare Plus AES keys (0 - 15) (fw version to 5.0.36) For key into SAM (1 - 127) For Mifare Plus and fw versions from 5.0.36 and library versions from 5.0.34. in MIFARE_AUTHENT1A or MIFARE_AUTHENT1B mode uses AES key calculated from Crypto1 key (0 -31), and in MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B mode uses AES keys (0 - 15) + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t block_address, uint8_t auth_mode, + IN const uint8_t *key); + + /** + * @brief Provided Key mode (PK) Decrements particular Value block with specified value using Block in Sector address. + * + * Mifare Plus X, SE and EV1 using. + * For firmware versions from 5.0.36 and library versions from 5.0.34, this functions may be used for Mifare plus cards. If authentication mode is MIFARE_AUTHENT1A or MIFARE_AUTHENT1B, AES key for authentication, and new AES key A and new AES key B are calculate from Crypto1 keys. If authentication mode is MIFARE_PLUS_AES_AUTHENT1A or MIFARE_PLUS_AES_AUTHENT1B, new AES keys are provided to reader. + * Multi reader support. + * @ingroup Card_Tag_Mifare_M + * + * @param hndUFR handle of the uFR device + * @param decrement_value value showing how much initial block value will be decremented + * @param sector_address Absolute Sector address + * @param block_in_sector_address Block address in Sector + * @param auth_mode Defines whether to perform authentication with key A or key B: use KeyA - MIFARE_AUTHENT1A = 0x60 or KeyB - MIFARE_AUTHENT1B = 0x61 For Mifare Plus tags (PK mode) defines whether to perform authentication with key A or key B: use KeyA - MIFARE_PLUS_AES_AUTHENT1A = 0x80 or KeyB - MIFARE_PLUS_AES_AUTHENT1B = 0x81 + * @param key Pointer to 6 byte array containing key bytes (PK mode) For Mifare Plus pointer to 16 bytes array containing AES key (PK mode) + * @return Operation status + */ + UFR_STATUS DL_API ValueBlockInSectorDecrement_PKM(UFR_HANDLE hndUFR, int32_t decrement_value, uint8_t sector_address, + uint8_t block_in_sector_address, uint8_t auth_mode, IN const uint8_t *key); + + /** + * @brief Multi reader support. Returns reader hardware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderHardwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + /** + * @brief Multi reader support. Returns reader firmware version as two byte representation of higher and lower byte. + * + * @ingroup ReaderAndLibrary_Information_M + + * @param hndUFR handle of the uFR device + * @param version_major pointer to version major variable + * @param version_minor pointer to version minor variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderFirmwareVersionM(UFR_HANDLE hndUFR, VAR uint8_t *version_major, VAR uint8_t *version_minor); + + // New commands (for RTC & I2C EEPROM): + /** + * @brief Multi reader support. Function returns a 6 bytes array of uint8_t that represents the current date and time into the device's RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderTimeM(UFR_HANDLE hndUFR, VAR uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into the device's RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in the GetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RTC_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password time + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API SetReaderTimeM(UFR_HANDLE hndUFR, IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Multi reader support. This function is used in Common, Advance and Access Control set of functions. + * It defines/changes password which I used for: + * * Locking/unlocking keys stored into reader + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API ChangeReaderPasswordM(UFR_HANDLE hndUFR, IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM. Maximal length of array is 128 bytes. Function requires password which length is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromWriteM(UFR_HANDLE hndUFR, IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM. Maximal length of array is 128 bytes. + * + * @ingroup ReaderAndLibrary_EEPROM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderEepromReadM(UFR_HANDLE hndUFR, OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Returns reader’s descriptive name as a row of 8 chars. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param pSerialDescription pointer to pSerialDescription array + * + * @return Operation status + */ + UFR_STATUS DL_API GetReaderSerialDescriptionM(UFR_HANDLE hndUFR, OUT uint8_t pSerialDescription[8]); + + // New since version 2.0: + /** + * @brief Multi reader support. Returns reader firmware build version as one byte representation. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * @param build pointer to build variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetBuildNumberM(UFR_HANDLE hndUFR, VAR uint8_t *build); + + /** + * @brief Multi reader support. This function returns UID of card actually present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. + * This function is recommended for use instead of GetCardId. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + /** + * @brief Multi reader support. This function returns UID of last card which was present in RF field of reader. + * + * It can handle all three known types : 4, 7 and 10 byte long UIDs. Difference with GetCardIdEx is that card does not be in RF field mandatory, UID value is stored in temporary memory area. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucSak returns pointer to variable which holds card type according to SAK + * @param aucUid returns pointer to array of card UID bytes, variable length + * @param lpucUidSize returns pointer to variable holding information about UID length + * + * @return Operation status + */ + UFR_STATUS DL_API GetLastCardIdExM(UFR_HANDLE hndUFR, VAR uint8_t *lpucSak, OUT uint8_t *aucUid, VAR uint8_t *lpucUidSize); + + //------------------------------------------------------------------------------ + // Multi card mode: + //------------------------------------------------------------------------------ + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Exits from “anti-collision” mode of operation i.e. put the reader in to “single card” mode of operation. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DisableAntiCollisionM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. If the reader is in an “anti-collision” mode of operation, this function enumerates cards which are found in the reader field. Otherwise the function returns ANTI_COLLISION_DISABLED status code. + * All the calls to the ListCards(), SelectCard() and DeselectCard() work with UIDs from the actual UID list of the enumerated cards, which is obtained by the last call of this function. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardsNumber If the function is successfully executed, the memory location on which this pointer points to, will contain a number of the enumerated cards. + * @param lpucUidListSize If the function is successfully executed, the memory location on which this pointer points to, will contain a UID list of the enumerated cards size in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API EnumCardsM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardsNumber, OUT uint8_t *lpucUidListSize); // Card pointer is on the first card in list + + /** + * @brief Multi reader support. Before calling this function you have to call EnumCards() first. + * For each UID of the cards detected in the reader field, there are 11 “UID record bytes” allocated in the list. First of those 11 bytes allocated designate actual UID length immediately followed by the exactly 10 bytes of UID (which is maximum hypothetical UID size). E.g, if the actual UID length is 4 bytes, you should ignore last 6 bytes of the UID record. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUidList Pointer to the memory alocated for the UID list. Before calling this function, you should alocate atleast *lpucUidListSize bytes which is returned by the prior call to EnumCards() function. + * @param ucUidListSize Size (in bytes) of the array alocated on the memory location aucUidList points to. + * + * @return Operation status + */ + UFR_STATUS DL_API ListCardsM(UFR_HANDLE hndUFR, OUT uint8_t *aucUidList, uint8_t ucUidListSize); // Before calling this function you must call EnumCards() first. + + /** + * @brief Multi reader support. Selects one of the cards which UID is on the actual UID list of the enumerated cards. If there is any of the cards previously selected calling this function you will get an CARD_ALREADY_SELECTED status code and, in such a case, you should call DeslectCard() function prior using SelectCard(). If UID list of the enumerated cards is empty, you will get an NO_TAGS_ENUMERRATED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param aucUid pointer to the byte array containing UID of the card which is to be selected + * @param ucUidSize actual UID size + * @param lpucSelctedCardType pointer to byte which will contain DlogicCardType constant of the selected card, in case of successful execution of this function + * + * @return Operation status + */ + UFR_STATUS DL_API SelectCardM(UFR_HANDLE hndUFR, IN const uint8_t *aucUid, uint8_t ucUidSize, OUT uint8_t *lpucSelctedCardType); + + /** + * @brief Multi reader support. If the reader is in a “anti-collision” mode of operation, this function deselects currently selected card. Otherwise function returns ANTI_COLLISION_DISABLED status code. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API DeslectCardM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Calling this function you can get current anti-collision status of the reader. + * + * @ingroup Card_Tag_CardFeatures_AntiCollision_M + * + * @param hndUFR handle of the uFR device + * @param lpcIsAntiCollEnabled pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation, 0 otherwise + * @param lpcIsAnyCardSelected pointer to byte which will contain 1 if reader is in a “anti-collision” mode of operation and there is selected card, 0 otherwise + * + * @return Operation status + */ + UFR_STATUS DL_API GetAntiCollisionStatusM(UFR_HANDLE hndUFR, VAR int8_t *lpcIsAntiCollEnabled, VAR int8_t *lpcIsAnyCardSelected); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns card type according to DlogicCardType enumeration. For details, please refer to Appendix: DLogic CardType enumeration. + * If the card type is not supported, function return the lpucCardType value equal to zero : TAG_UNKNOWN = 0x00 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpucCardType pointer to lpucCardType variable. Variable lpucCardType holds returned value of actual card type present in RF field. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDlogicCardTypeM(UFR_HANDLE hndUFR, VAR uint8_t *lpucCardType); + + /** + * @brief Multi reader support. + * This function returns card manufacturer as char* buffer (c-style string). + * + * For details, please refer to the ISO/IEC JTC1/SC17 STANDING DOCUMENT 5 + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param card_manufacturer_str manufacturer name as c_string. + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardManufacturerM(UFR_HANDLE hndUFR, OUT char *card_manufacturer_str); + + + /** + * @brief Multi reader support. This function returns 8 bytes of the T2T version. All modern T2T chips support this functionality and have in common a total of 8 byte long version response. This function is primarily intended to use with NFC_T2T_GENERIC tags (i.e. tags which return 0x0C in the *lpucCardType parameter of the GetDlogicCardType()). + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param lpucVersionResponse array containing 8 bytes which will receive raw T2T version. + * + * @return Operation status + */ + UFR_STATUS DL_API GetNfcT2TVersionM(UFR_HANDLE hndUFR, OUT uint8_t lpucVersionResponse[8]); + + /** + * @brief Multi reader support. Function returns size of user data space on the card (LinearSize), and size of total data space on the card (RawSize). The user data space is accessed via functions LinearWrite and LinearRead. Total data space is accessed via functions LinRowWrite and LinRowRead. For example Mifare Classic 1K card have 752 bytes of user data space (sector trailers and block 0 are not included), and 1024 bytes of total data space. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param lpulLinearSize pointer to variable which contain size of user data space + * @param lpulRawSize pointer to variable which contain size of total data space + * + * @return Operation status + */ + UFR_STATUS DL_API GetCardSizeM(UFR_HANDLE hndUFR, VAR uint32_t *lpulLinearSize, VAR uint32_t *lpulRawSize); + + /** + * @brief Function provides the information about the tag tamper status which is detected when the NTAG 213 TT is powered by an RF field. + * + * Multi reader support. From library version 5.0.59 and firmware version 5.0.60 + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * @param tt_message 4 byte Tag Tamper message. “0000” is returned, if the NTAG 213 TT has never detected the Tag Tamper as opened during the startup. If the NTAG 213 TT has once detected the tag tamper wire as opened, it returns the data which have been programmed in page 45 (TT_MESSAGE) + * @param tt_status status of the tag tamper wire detected during startup. “C” if Tag Tamper was closed at current startup “O” if Tag Tamper was open at current startup “I” if Tag Tamper measurement was incorrect + * + * @return Operation status + */ + UFR_STATUS DL_API ReadTTStatusM(UFR_HANDLE hndUFR, OUT uint8_t *tt_message, VAR uint8_t *tt_status); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. Function returns “mobile additional” data if the tag in the reader field is actually the selected HCE application in a mobile phone with the appropriate AID which can be set using the SetMobileUniqueIdAid() API. The indication that the HCE application in the mobile phone with the corresponding AID is actually selected is the card type code 0x60 (DL_MOBILE_AID) obtained by the previous call to the GetDlogicCardType() or GetCardIdEx() API. + * + * @param hndUFR handle of the uFR device + * @param data Array of bytes that should have at least 32 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function and after the successful execution contains size of the data returned by the reader (max. 32 bytes) + * + * @ingroup Card_Tag_M + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileAdditionalDataM(UFR_HANDLE hndUFR, uint8_t data[32], uint32_t *len); + + /** + * @brief Multi reader support. Function returns reader’s serialized discovery loop structure i.e. C union (following gcc example): + * typedef union { + * __attribute ((packed)) struct { + * uint16_t flags; + * uint32_t RFU; + * }; + * __attribute ((packed)) struct { + * uint8_t byte0; + * uint8_t byte1; + * uint32_t RFU; + * } bytes; + * __attribute ((packed)) struct { + * uint8_t legacy:1; + * uint8_t enable_type_a:1; + * uint8_t enable_type_b:1; + * uint8_t enable_apple_ecp:1; + * uint8_t enable_hce:1; + * uint8_t auto_select_dlogic_aid:1; + * uint8_t auto_select_apple_vas:1; + * uint8_t auto_select_google_vas:1; + * uint8_t RFU_flags; + * uint32_t RFU; + * } bits; + * } discovery_loop_setup_t; + * sizeof (discovery_loop_setup_t) is 6 bytes. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the array of bytes that should have at least sizeof (discovery_loop_setup_t) i.e. 6 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least sizeof (discovery_loop_setup_t) i.e. 6 bytes) and after the successful execution contains size of the data returned by the reader. + * + * @return Operation status + */ + UFR_STATUS DL_API GetDiscoveryLoopSetupM(UFR_HANDLE hndUFR, uint8_t *setupStruct, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s discovery loop. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param setupStruct Pointer to the serialized discovery loop structure. + * @param len Size of the serialized discovery loop structure. e.g. sizeof (discovery_loop_setup_t) i.e. 6 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SetDiscoveryLoopM(UFR_HANDLE hndUFR, const uint8_t *setupStruct, uint32_t len); + + /** + * @brief Multi reader support. Function returns the AID set in the reader to retrieve the mobile phone's unique ID. If the reader’s AID has never been set using SetMobileUniqueIdAid(), the function returns UFR_READING_ERROR status and the reader uses the default AID which is + * {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes that should have at least 16 bytes previously allocated. + * @param len Pointer to the variable containing actual size of the data array before calling this function (at least 16) and after the successful execution contains size of the data returned by the reader (max. 16 bytes) + * + * @return Operation status + */ + UFR_STATUS DL_API GetMobileUniqueIdAidM(UFR_HANDLE hndUFR, uint8_t *aid, uint32_t *len); + + /** + * @brief Multi reader support. Function sets the reader’s AID to retrieve the mobile phone's unique ID. + * + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * The default (factory) uFR AID is {0xF0, 0x01, 0x02, 0x03, 0x04, 0x05}. + * Minimum AID length is 5 bytes. Maximum AID len is 16 bytes. + * For details, see the example project at the + * https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-aid_for_mobile_unique_id_setup. + * + * @ingroup ReaderAndLibrary_uFRZeroSpecificFeatures_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to the array of bytes containing the new AID. + * @param len Size of the new AID in bytes. + * + * @return Operation status + */ + UFR_STATUS DL_API SetMobileUniqueIdAidM(UFR_HANDLE hndUFR, const uint8_t *aid, uint32_t len); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockConfigM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockDataAndOtpM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ATECC608LockKeySlotM(UFR_HANDLE hndUFR, uint8_t key_slot); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultSlotsConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608DefaultKeysConfigurationM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608IOSecretKeyM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyUnencryptedM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetATECC608ECCPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_slot, uint8_t bool_enabled, + uint8_t pub_key_id[4], uint8_t merchant_id[32], uint8_t ecc_priv_key[32]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ConfigZoneM(UFR_HANDLE hndUFR, uint8_t config_zone[128]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608OtpZoneM(UFR_HANDLE hndUFR, uint8_t otp_zone[64]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608ZonesLockStatusM(UFR_HANDLE hndUFR, VAR uint8_t *bool_config_zone_locked, + VAR uint8_t *bool_otp_zone_locked); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetATECC608InfoRevisionM(UFR_HANDLE hndUFR, uint8_t revision[4]); + + //------------------------------------------------------------------------------ + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderProModeM(UFR_HANDLE hndUFR, VAR uint32_t *pReaderProMode, OUT uint32_t *pReaderProConfig); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API SetReaderProModeM(UFR_HANDLE hndUFR, const uint32_t ReaderProMode); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_InitializeM(UFR_HANDLE hndUFR, IN const uint8_t *TBSerialString, uint16_t job_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextEncryptedCardM(UFR_HANDLE hndUFR, const uint32_t from_timestamp, const uint32_t to_timestamp, + OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetNextM(UFR_HANDLE hndUFR, const uint32_t code_type, const uint32_t from_timestamp, + const uint32_t to_timestamp, const uint32_t additional_data_size, + IN const uint8_t additional_data[], VAR uint32_t *out_card_data_size, OUT uint8_t out_card_data[]); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetActualCardSNM(UFR_HANDLE hndUFR, OUT uint32_t *ActualCard_SN, VAR uint32_t *ActualCard_SN_LOG); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetJobSNM(UFR_HANDLE hndUFR, VAR uint32_t *JobSN); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API CardEncryption_GetSalterSNM(UFR_HANDLE hndUFR, OUT uint8_t SalterSN[8], VAR uint8_t *magicByte); + + /** + * @brief Multi reader support. Function returns TNF, type of record, ID and payload from the NDEF record. NDEF record shall be elected by the message ordinal and record ordinal in this message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param record_nr NDEF record ordinal (in message) + * @param tnf pointer to the variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * + * @return Operation status + */ + UFR_STATUS DL_API read_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t record_nr, VAR uint8_t *tnf, OUT uint8_t *type_record, + VAR uint8_t *type_length, OUT uint8_t *id, VAR uint8_t *id_length, OUT uint8_t *payload, + VAR uint32_t *payload_length); + + /** + * @brief Multi reader support. Function adds a record to the end of message, if one or more records already exist in this message. If current message is empty, then this empty record will be replaced with the record. Parameters of function are: ordinal of message, TNF, type of record, ID, payload. Function also returns pointer to the variable which reported that the card formatted for NDEF using (card does not have a capability container, for example new Mifare Ultralight, or Mifare Classic card). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, uint8_t *type_length, + IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, uint32_t *payload_length, + VAR uint8_t *card_formated); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroringM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. This function works the same as the write_ndef_record(), with the additional “UID and / or NFC counter mirror” features support. NTAG 21x family of devices offers these specific features. For details about “ASCII mirror” features refer to http://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf (in Rev. 3.2 from 2. June 2015, page 20) and http://www.nxp.com/docs/en/data-sheet/NTAG210_212.pdf (in Rev. 3.0 from 14. March 2013, page 16). + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts from 1) + * @param tnf pointer to variable containing TNF of record + * @param type_record pointer to array containing type of record + * @param type_length pointer to the variable containing length of type of record string + * @param id pointer to array containing ID of record + * @param id_length pointer to the variable containing length of ID of record string + * @param payload pointer to array containing payload of record + * @param payload_length pointer to the variable containing length of payload + * @param card_formated pointer to the variable which shows that the card formatted for NDEF using. + * @param use_uid_ascii_mirror if use_uid_ascii_mirror == 1 then “UID ASCII Mirror” feature is in use. if use_uid_ascii_mirror == 0 then “UID ASCII Mirror” feature is switched off. + * @param use_counter_ascii_mirror if use_counter_ascii_mirror == 1 then “NFC counter ASCII Mirror” feature is in use. if use_counter_ascii_mirror == 0 then “NFC counter ASCII Mirror” feature is switched off. payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * @param use_tt_message_mirror if use_tt_message_mirror == 1 then Tag tamper status mirroring is enabled + * @param payload_mirroring_pos Defines the starting position of the “ASCII Mirror” into the NDEF record payload. + * + * @return Operation status + */ + UFR_STATUS DL_API write_ndef_record_mirroring_ttM(UFR_HANDLE hndUFR, uint8_t message_nr, uint8_t *tnf, IN uint8_t *type_record, + uint8_t *type_length, IN uint8_t *id, uint8_t *id_length, IN uint8_t *payload, + uint32_t *payload_length, VAR uint8_t *card_formated, int use_uid_ascii_mirror, + int use_counter_ascii_mirror, int use_tt_message_mirror, uint32_t payload_mirroring_pos); + + /** + * @brief Multi reader support. Function returns the number of NDEF messages that have been read from the card, and number of NDEF records, number of NDEF empty messages. Also, function returns array of bytes containing number of messages pairs. First byte of pair is message ordinal, and second byte is number of NDEF records in that message. Message ordinal starts from 1. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_message_cnt pointer to the variable containing number of NDEF messages + * @param ndef_record_cnt pointer to the variable containing number of NDEF record + * @param ndef_record_array pointer to the array of bytes containing pairs (message ordinal - number of records) + * @param empty_ndef_message_cnt pointer to the variable containing number of empty messages + * + * @return Operation status + */ + UFR_STATUS DL_API get_ndef_record_countM(UFR_HANDLE hndUFR, VAR uint8_t *ndef_message_cnt, VAR uint8_t *ndef_record_cnt, + OUT uint8_t *ndef_record_array, VAR uint8_t *empty_ndef_message_cnt); + + /** + * @brief Multi reader support. Function deletes the last record of the selected message. If a message contains one record, then it will be written as an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_last_ndef_recordM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function deletes all records of the message, then writes an empty message. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message_nr NDEF message ordinal (starts form 1) + * + * @return Operation status + */ + UFR_STATUS DL_API erase_all_ndef_recordsM(UFR_HANDLE hndUFR, uint8_t message_nr); + + /** + * @brief Multi reader support. Function prepares the card for NDEF using. Function writes Capability Container (CC) if necessary, and writes empty message. If the card is MIFARE CLASSIC or MIFARE PLUS, then the function writes MAD (MIFARE Application Directory), and default keys and access bits for NDEF using. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ndef_card_initializationM(UFR_HANDLE hndUFR); + + //--------------------------------------------------------------------- + // Card emulation: + //--------------------------------------------------------------------- + + /** + * @brief Multi reader support. Function stores a message record for NTAG emulation mode into the reader. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 144 bytes. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefM(UFR_HANDLE hndUFR, uint8_t tnf, IN uint8_t *type_record, uint8_t type_length, IN uint8_t *id, + uint8_t id_length, IN uint8_t *payload, uint8_t payload_length); + + /** + * @brief Multi reader support. Put the reader permanently in a NDEF tag emulation mode. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling TagEmulationStop() function). + * In this mode, the reader can only answer to the commands issued by a following library functions: + * TagEmulationStart(), + * WriteEmulationNdef(), + * TagEmulationStop(), + * GetReaderSerialNumber(), + * GetReaderSerialDescription(), + * GetReaderHardwareVersion(), + * GetReaderFirmwareVersion(), + * GetBuildNumber() + * Calls to the other functions in this mode returns following error code: + * FORBIDDEN_IN_TAG_EMULATION_MODE = 0x90 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Allows the reader permanent exit from a NDEF tag emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API TagEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Puts the uFR reader into a permanently periodical switching from “NDEF tag emulation mode” to “tag reader mode”. Only way for a reader to exit from this mode is to receive the TAG_EMULATION_STOP command (issued by calling the TagEmulationStop() function). + * Much better control of the NFC device in a uFR proximity range can be achieved using Ad-Hoc emulation mode, described before. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_CombinedMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CombinedModeEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Put uFR in emulation mode with ad-hoc emulation parameters (see. SetAdHocEmulationParams() and GetAdHocEmulationParams() functions). uFR stays in ad-hoc emulation mode until AdHocEmulationStop() is called or reader reset. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStartM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Terminate uFR ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API AdHocEmulationStopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This function returns current ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15. + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15. + * + * @return Operation status + */ + UFR_STATUS DL_API GetAdHocEmulationParamsM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. This command set ad-hoc emulation parameters. On uFR power on or reset ad-hoc emulation parameters are set back to their default values. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel default value is 15. Could be in range from 0 to 15 + * @param ThresholdCollLevel default value is 7. Could be in range from 0 to 7 + * @param RFLevelAmp default value is 0. On uFR device should be 0 all the time. (1 for on, 0 for off). + * @param RxGain Could be in range from 0 to 7. + * @param RFLevel Could be in range from 0 to 15 + * + * @return Operation status + */ + UFR_STATUS DL_API SetAdHocEmulationParamsM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. Returns external field state when uFR is in ad-hoc emulation mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AdHocMode_M + * + * @param hndUFR handle of the uFR device + * @param is_field_present contains 0 if external field isn’t present or 1 if field is present. + * + * @return Operation status + */ + UFR_STATUS DL_API GetExternalFieldStateM(UFR_HANDLE hndUFR, VAR uint8_t *is_field_present); + + /** + * @brief Multi reader support. Put reader permanently in the mode that use shared RAM. After execution of this function, must be executed function TagEmulationStart. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EnterShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The permanent exit from mode that use shared RAM. After execution of this function, must be executed function TagEmulationStop. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ExitShareRamCommModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Function allows writing data to the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. Function allows read data from the shared RAM. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SharedRAM_M + * + * @param hndUFR handle of the uFR device + * @param ram_data pointer to data array + * @param addr address of first data in an array + * @param data_len length of array. Address + data_len <= 184 + * + * @return Operation status + */ + UFR_STATUS DL_API ReadShareRamM(UFR_HANDLE hndUFR, uint8_t *ram_data, uint8_t addr, uint8_t data_len); + + /** + * @brief Multi reader support. From library version 5.0.31, and firmware version 5.0.33 + * Function stores a message record for NTAG emulation mode into the reader in the RAM. Parameters of the function are: TNF, type of record, ID, payload. Maximum total size for emulated NDEF message is 1008 bytes. Unlike the function WriteEmulationNdef, the data is not written to the EEPROM of the reader, so they cannot be loaded after the reader is reset. This function must be called after reader reset to use the NTAG emulation. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_TagEmulationMode_M + * + * @param hndUFR handle of the uFR device + * @param tnf TNF of the record + * @param type_record pointer to the array containing record type + * @param type_length length of the record type + * @param id pointer to the array containing record ID + * @param id_length length of the record ID + * @param payload pointer to the array containing record payload + * @param payload_length length of the record payload + * + * @return Operation status + */ + UFR_STATUS DL_API WriteEmulationNdefRamM(UFR_HANDLE hndUFR, uint8_t tnf, uint8_t *type_record, uint8_t type_length, + uint8_t *id, uint8_t id_length, uint8_t *payload, uint32_t payload_length); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking_M + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureM(UFR_HANDLE hndUFR, IN uint8_t lpucECCSignature[ECC_SIG_LEN], OUT uint8_t lpucUid[MAX_UID_LEN], + VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * This function returns the ECC signature of the card chip UID. Card chip UID is signed using EC private key known only to a manufacturer. + * Unlike the ReadECCSignature function, this function supports ECC with variable length. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucECCSignatureLen pointer to ECC signature length + * @param lpucUid pointer to a chip UID (in case of successfully executed operation). Returned here for convenience. + * @param lpucUidLen pointer to variable which will (in case of successfully executed operation) receive true length of the returned UID. (Maximum UID length is 10 bytes but there is three possible UID sizes: 4, 7 and 10). + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API ReadECCSignatureExtM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucECCSignatureLen, + OUT uint8_t *lpucUid, VAR uint8_t *lpucUidLen, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used to read one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. In the initial Ultralight EV1 chip state, the counter values are set to 0. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param value Pointer to a uint32_t which will contained counter value after successful function execution. Since counters are 24-bit in length, most significant byte of the *value will be always 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, VAR uint32_t *value); + + /** + * @brief Multi reader support. This function is used to increment one of the three 24-bit one-way counters in Ultralight EV1 chip family. Those counters can’t be password protected. If the sum of the addressed counter value and the increment value is higher than 0xFFFFFF, the tag replies with an error and does not update the respective counter. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param counter_address Address of the target counter. Can be in range 0 to 2. Counters are mapped in a separate address space. + * @param inc_value Increment value. Only the 3 least significant bytes are relevant. + * + * @return Operation status + */ + UFR_STATUS DL_API IncrementCounterM(UFR_HANDLE hndUFR, uint8_t counter_address, uint32_t inc_value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counters in NTAG 213, NTAG 215 and NTAG 216 chips without using password authentication. If access to the NFC counter is configured to be password protected, this function will return COUNTER_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successfulfunction execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterM(UFR_HANDLE hndUFR, VAR uint32_t *value); // Same as ReadCounter(2, &value); + + /** + * @brief Multi reader support. This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param reader_key_index Index of the 6-byte key (PWD-PACK pair for this type of NFC tags) stored in the uFR reader. Can be in range 0 to 31. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_RKM(UFR_HANDLE hndUFR, VAR uint32_t *value, uint8_t reader_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * This function is used to read 24-bit NFC counter in NTAG 213, NTAG 215 and NTAG 216 chips using “reader key password authentication”. If access to NFC counter is configured to be password protected and PWD-PACK pair stored as a 6-byte key in uFR reader disagrees with PWD-PACK pair configured in tag, this function will return UFR_AUTH_ERROR. If access to NFC counter isn’t configured to be password protected, this function will return UFR_AUTH_ERROR. + * + * @ingroup Card_Tag_NTAG_2XX_M + * + * @param hndUFR handle of the uFR device + * @param value Pointer to a uint32_t which will contain counter value after successful function execution. Since counter is 24-bit in length, most significant byte of the *value will always be 0. + * @param key ointer to an array contains provided 6-byte key (PWD-PACK pair for this type of NFC tags) for password authentication. + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNFCCounterPwdAuth_PKM(UFR_HANDLE hndUFR, VAR uint32_t *value, IN const uint8_t *key); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. This function is used for the “Asynchronous UID sending” feature. Returned string contains hexadecimal notation of card ID with one mandatory suffix character and one optional prefix character. + * On the uFR Zero USB series there is an option to enable USB HID keyboard simulation. It is needed to set the baud rate to 0. For example, if baud rate is setted to any other value than 0, UID is sent to UART, but if it is setted to 0 UID is sent as keyboard simulation. + * Example: + * Card ID is 0xA103C256, prefix is 0x58 ('X'), suffix is 0x59 ('Y') + * Returned string is “XA103C256Y” + * Function sets configuration parameters for this feature. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Function sets the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable turn feature on/off (0/1) + * @param prefix_enable use prefix or not (0/1) + * @param prefix prefix character + * @param suffix suffix character + * @param send_removed_enable Turn feature on/off (0/1). If feature is enabled then Asynchronous UID will also be sent when removing a card from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate baud rate value (e.g. 9600) + * + * @return Operation status + */ + UFR_STATUS DL_API SetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, uint8_t send_enable, uint8_t prefix_enable, uint8_t prefix, uint8_t suffix, + uint8_t send_removed_enable, uint8_t reverse_byte_order, uint8_t decimal_representation, + uint32_t async_baud_rate); + + /** + * @brief Multi reader support. Returns info about parameters configured with previous function. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param async_baud_rate pointer to variable holding configured baud rate + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint32_t *async_baud_rate); + + /** + * @brief Multi reader support. Function returns the parameters of card ID sending. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending_M + * + * @param hndUFR handle of the uFR device + * @param send_enable pointer, if feature is on/off (0/1) + * @param prefix_enable pointer, if prefix is used or not (0/1) + * @param prefix pointer to variable holding prefix character + * @param suffix pointer to variable holding suffix character + * @param send_removed_enable Pointer. If value is 0 then feature is off. Otherwise, feature is on. If feature is enabled then Asynchronous UID is sent when the card is removed from the reader field. + * @param reverse_byte_order Turn feature on/off (0/1). If feature is disabled then the order of bytes (UID) will be as on card. If feature is enabled then the order of bytes will be reversed then the card’s order of bytes. + * @param decimal_representation Turn feature on/off (0/1). If feature is enabled then the UID will be presented as a decimal number. If feature is disabled then the UID will be presented as a hexadecimal number + * @param async_baud_rate pointer to baud rate variable + * + * @return Operation status + */ + UFR_STATUS DL_API GetAsyncCardIdSendConfigExM(UFR_HANDLE hndUFR, VAR uint8_t *send_enable, VAR uint8_t *prefix_enable, VAR uint8_t *prefix, + VAR uint8_t *suffix, VAR uint8_t *send_removed_enable, VAR uint8_t *reverse_byte_order, + VAR uint8_t *decimal_representation, VAR uint32_t *async_baud_rate); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to set custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode sets idle mode value + * @param card_detection_mode sets card detection mode value + * @param idle_color sets idle color + * @param card_detection_color sets card detection color + * @param enabled value that enables it (1) or disables it (0) + * + * @return Operation status + */ + UFR_STATUS DL_API SetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t idle_mode, uint8_t card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t enabled); + + /** + * @brief *uFR Zero series readers only + * Multi reader support. + * Function to get custom RGB UI signalization + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param idle_mode returns idle mode value + * @param card_detection_mode returns card detection mode value + * @param idle_color returns idle color + * @param card_detection_color returns card detection color + * @param enabled returns 1 if enabled, 0 if disabled + * + * @return Operation status + */ + UFR_STATUS DL_API GetCustomUiConfigM(UFR_HANDLE hndUFR, uint8_t *idle_mode, uint8_t *card_detection_mode, uint8_t *idle_color, uint8_t *card_detection_color, uint8_t *enabled); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_numberM(UFR_HANDLE hndUFR, VAR uint32_t *card_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, uint16_t last_reader_nr, + uint8_t start_hour, uint8_t start_minute, uint8_t end_hour, uint8_t end_minute, IN uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint16_t *first_reader_nr, + VAR uint16_t *last_reader_nr, VAR uint8_t *start_hour, VAR uint8_t *start_minute, + VAR uint8_t *end_hour, VAR uint8_t *end_minute, OUT uint8_t *days); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_erase_right_recordM(UFR_HANDLE hndUFR, uint8_t record_number); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_validate_recordM(UFR_HANDLE hndUFR, uint8_t begin_year, uint8_t begin_month, uint8_t begin_day, + uint8_t begin_hour, uint8_t begin_minute, uint8_t end_year, uint8_t end_month, uint8_t end_day, + uint8_t end_hour, uint8_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_validate_recordM(UFR_HANDLE hndUFR, VAR uint8_t *begin_year, VAR uint8_t *begin_month, VAR uint8_t *begin_day, + VAR uint8_t *begin_hour, VAR uint8_t *begin_minute, VAR uint8_t *end_year, + VAR uint8_t *end_month, VAR uint8_t *end_day, VAR uint8_t *end_hour, VAR uint8_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_typeM(UFR_HANDLE hndUFR, uint8_t card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_typeM(UFR_HANDLE hndUFR, VAR uint8_t *card_type); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_daily_durationM(UFR_HANDLE hndUFR, uint16_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_daily_durationM(UFR_HANDLE hndUFR, VAR uint16_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_card_total_durationM(UFR_HANDLE hndUFR, uint32_t duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_card_total_durationM(UFR_HANDLE hndUFR, VAR uint32_t *duration); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_credit_and_period_validityM(UFR_HANDLE hndUFR, VAR int32_t *credit, VAR uint32_t *begin_year, + VAR uint32_t *begin_month, VAR uint32_t *begin_day, VAR uint32_t *begin_hour, + VAR uint32_t *begin_minute, VAR uint32_t *end_year, VAR uint32_t *end_month, + VAR uint32_t *end_day, VAR uint32_t *end_hour, VAR uint32_t *end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_credit_and_period_validityM(UFR_HANDLE hndUFR, int32_t credit, uint32_t begin_year, uint32_t begin_month, + uint32_t begin_day, uint32_t begin_hour, uint32_t begin_minute, uint32_t end_year, + uint32_t end_month, uint32_t end_day, uint32_t end_hour, uint32_t end_minute); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, uint8_t right_record_type, IN uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_get_right_type_recordM(UFR_HANDLE hndUFR, uint8_t record_number, VAR uint8_t *right_record_type, + OUT uint8_t *right_data); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API ais_set_right_record_type_max_daily_counterM(UFR_HANDLE hndUFR, uint8_t record_number, uint16_t first_reader_nr, + uint16_t last_reader_nr, uint8_t start_hour, uint8_t start_minute, + uint8_t end_hour, uint8_t end_minute, IN uint8_t *days, + uint8_t max_daily_counter); + + //============================================================================= + + /** + * @brief Multi reader support. Electric strike switches when the function is called. Pulse duration determined by function. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param pulse_duration pulse_duration is strike switch on period in ms + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcLockOnM(UFR_HANDLE hndUFR, uint16_t pulse_duration); + + /** + * @brief Multi reader support. Function switches relay. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param state if the state is 1, then relay is switch on, and if state is 0, then relay is switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcRelayStateM(UFR_HANDLE hndUFR, uint8_t state); + + /** + * @brief Multi reader support. Function returns states of 3 IO pins. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param intercom shows that there is voltage at the terminals for intercom connection, or not + * @param door shows that the door's magnetic switch opened or closed + * @param relay_state is 1 if relay switch on, and 0 if relay switch off + * + * @return Operation status + */ + UFR_STATUS DL_API UfrXrcGetIoStateM(UFR_HANDLE hndUFR, VAR uint8_t *intercom, VAR uint8_t *door, VAR uint8_t *relay_state); + + /** + * @brief + * Multi reader support. Function controls the output pin on the reader. + * + * @ingroup ReaderAndLibrary_BaseHDUFR_M + * + * @param hndUFR handle of the uFR device + * @param output_nr ordinal number of hardware specific output pin + * @param invert 1 output is inverted, 0 output is normal + * @param cycle_nr Number of on-off cycles. If the cycle number is 0, the output state will be infinite, or until this will be changed with the next function call (output state is 1 if the invert is 0, and 0 if invert is 1). + * @param on_duration On duration in ms. If the invert is 0 output state is 1, and if invert is 1 output state is 0. + * @param off_duration Off duration in ms. If the invert is 0 output state is 0, and if invert is 1 output state is 1. This state of the output pin remains after the completion of the on-off cycle. + * + * @return Operation status + */ + UFR_STATUS DL_API UfrOutControlM(UFR_HANDLE hndUFR, uint8_t output_nr, uint8_t invert, uint8_t cycle_nr, uint8_t on_duration, uint8_t off_duration); + + /** + * @brief Multi reader support. This function turns Red LED only. + * If “light_status” value is 1, red light will be constantly turned on until receive “light_status “ value 0. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param light_status value 0 or 1 + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRedLightControlM(UFR_HANDLE hndUFR, uint8_t light_status); + + /** + * @brief Multi reader support. For classic uFR PLUS devices only. + * The function prohibits the blinking of the green diode (if this option is set), and sets color on RGB diodes. This color stays on diodes until this function sets the parameter "enable" to 0. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.55. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * + * @return Operation status + */ + UFR_STATUS DL_API RgbControlM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbExtLightControlM(UFR_HANDLE hndUFR, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.64. + * The function sets color on the RGB diodes. This setting will appear when the reader is in sleep mode. Function adjusts the period, and duration of impulse of light. The period is a product of approximately two seconds (2s, 4s, 6s, 8s,...). Maximal duration of impulse of light is 2000 ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period number of the 2 seconds period. (1 = 2s, 2 = 4s, 3 = 6s, …) + * @param duration duration of impulse of light in ms. + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlSleepM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint8_t period, uint16_t duration, uint8_t enable); + + /** + * @brief Multi reader support. From version 5.0.66. + * The function sets color on the RGB diodes, period of inactivity NFC RF and RGB, and duration of activity NFC RF and RGB. In the inactivity period NFC RF is off, and RGB light is off. In the activity period NFC RF is on, and RGB may be on. Function also sets the number of omitted activity periods, when the RGB light is off. For example if the inactivity period is 400ms, activity duration is 50ms, and number of omitted activity periods is 5, RGB lights will be on 50ms at every 2250ms. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param red value of red color (0 - 255) + * @param green value of green color (0 - 255) + * @param blue value of blue color (0 - 255) + * @param intensity value of color intensity in percent (0 - 100) + * @param period inactivity period in ms + * @param duration duration of activity period in ms + * @param rgb_omitted_cnt number of omitted activity periods + * @param enable 1 - enable 0 - disable + * + * @return Operation status + */ + UFR_STATUS DL_API UfrRgbLightControlRfPeriodM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue, uint8_t intensity, + uint16_t period, uint16_t duration, uint8_t rgb_omitted_cnt, uint8_t enable); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleSetM(UFR_HANDLE hndUFR, uint8_t red, uint8_t green, uint8_t blue); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbIdleDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows you to set the number of unsuccessful card selections before it can be considered that the card is not placed on the reader. Period between two card selections is approximately 10ms. Default value of this parameter is 20 i.e. 200ms. This parameter can be set in the range of 0 to 254. + * This is useful for asynchronous card ID transmission, if parameter send_removed_enable in function SetAsyncCardIdSendConfig is set. Then you can set a lower value of the number of unsuccessful card selections, in order to send information to the card removed was faster. + * A small value of this parameter may cause a false report that the card is not present, and immediately thereafter true report that the card is present. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrSetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, uint8_t bad_select_nr_max); + + /** + * @brief Multi reader support. The function returns value of maximal unsuccessful card selections, which is set in reader. + * + * @ingroup ReaderAndLibrary_M + * + * @param hndUFR handle of the uFR device + * @param bad_select_nr_max pointer to number of unsuccessful card selections + * + * @return Operation status + */ + UFR_STATUS DL_API UfrGetBadSelectCardNrMaxM(UFR_HANDLE hndUFR, VAR uint8_t *bad_select_nr_max); + + /** + * @brief Multi reader support. Turn the device into Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrEnterSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Wake up device from Sleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API UfrLeaveSleepModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Turn the device into Sleep mode after a certain amount of time. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepSetM(UFR_HANDLE hndUFR, uint8_t seconds_wait); + + /** + * @brief Multi reader support. Get status of AutoSleep mode. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_SleepAutoSleep_M + * + * @param hndUFR handle of the uFR device + * @param seconds_wait variable holding value of seconds to wait before entering into sleep. If the parameter is 0x00, the AutoSleep feature is turned off (default state). + * + * @return Operation status + */ + UFR_STATUS DL_API AutoSleepGetM(UFR_HANDLE hndUFR, VAR uint8_t *seconds_wait); + + /** + * @brief Multi reader support. This function is used for setting communication speed between reader and ISO144443-4 cards. For other card types, a default speed of 106 kbps is in use. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed setup value for transmit speed + * @param rx_speed setup value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeedPermanentlyM(UFR_HANDLE hndUFR, unsigned char tx_speed, unsigned char rx_speed); + + /** + * @brief Multi reader support. Returns baud rate configured with previous function. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param tx_speed pointer to variable, returns configured value for transmit speed + * @param rx_speed pointer to variable, returns configured value for receive speed + * + * @return Operation status + */ + UFR_STATUS DL_API GetSpeedParametersM(UFR_HANDLE hndUFR, VAR unsigned char *tx_speed, VAR unsigned char *rx_speed); + + /** + * @brief Multi reader support. Function enables sending data to the display. A string of data contains information about the intensity of color in each cell of the display. Each cell has three LED (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 16 cells, an array contains 48 bytes. Value of intensity is in range from 0 to 255. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayDataM(UFR_HANDLE hndUFR, IN uint8_t *display_data, uint8_t data_length); + + /** + * @brief Multi reader support. From version 5.0.55 + * Function has the same functionality as the function SetDisplayData. New feature is the RGB port selection. Internal port uses RGB diodes on the reader PCB. Card size reader has two diodes. XL reader has four diodes. External port uses LED RING with RGB diodes. + * Before the function calls, the function GreenLedBlinkingTurnOff must be called, or the reader is already in mode of blocking automatic signalization. Function sets the color of the RGB diodes. This color stays on the RGB until the function GreenLedBlinkingTurnOn is called. Intensity of light is defined by a parameter stored using the function SetRgbIntensity. + * + * @ingroup ReaderAndLibrary_RGBSignalization_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of data into array + * @param port_name EXTERNAL_RGB_PORT INTERNAL_RGB_PORT + * + * @return Operation status + */ + UFR_STATUS DL_API SetRgbDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint8_t port_name); + + /** + * @brief Multi reader support. This function plays constant sound of “frequency” Hertz. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * @param frequency frequency in Hz To stop playing sound, send 0 value for “frequency”. + * + * @return Operation status + */ + UFR_STATUS DL_API SetSpeakerFrequencyM(UFR_HANDLE hndUFR, uint16_t frequency); + + /** + * @brief Multi reader support. SetRgbIntensity (alias from version 5.0.55) + * Function sets the intensity of light on the display. Value of intensity is in the range 0 to 100. This value writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API SetDisplayIntensityM(UFR_HANDLE hndUFR, uint8_t intensity); + + /** + * @brief Multi reader support. GetRgbIntensity (alias from version 5.0.55) + * Function gets the intensity of light on the display. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_DisplayControl_M + * + * @param hndUFR handle of the uFR device + * @param intensity value of intensity (0 - 100) + * + * @return Operation status + */ + UFR_STATUS DL_API GetDisplayIntensityM(UFR_HANDLE hndUFR, VAR uint8_t *intensity); + + // ############################################################################# + // ############################################################################# + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_ModeM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Call SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS(). ISO 14443-4 tag in a field will be selected and RF field polling will be stopped. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ats After successful function execution, buffer on which this pointer points to will contain ATS returned from the TAG (historical bytes included). Before calling this function, you have to allocate MAX_ATS_LEN bytes for the ats buffer. MAX_ATS_LEN macro is defined in uFCoder.h (#define MAX_ATS_LEN 25). + * @param ats_len After successful function execution, variable on which this pointer points to will contain actual ATS length. + * @param uid After successful call to this function, buffer on which this pointer points to will contain TAG UID. Before calling this function, you have to allocate MAX_UID_LEN bytes for the ats buffer. MAX_UID_LEN macro is defined in uFCoder.h (#define MAX_UID_LEN 10). + * @param uid_len After successful function execution, variable on which this pointer points to will contain actual UID length. + * @param sak After successful function execution, variable on which this pointer points to will contain SAK (Select Acknowledge) of the TAG in field. + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_Mode_GetATSM(OUT UFR_HANDLE hndUFR, uint8_t ats[MAX_ATS_LEN], VAR uint8_t *ats_len, + OUT uint8_t uid[MAX_UID_LEN], VAR uint8_t *uid_len, VAR uint8_t *sak); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API SetISO14443_4_DLStorageM(UFR_HANDLE hndUFR); + + /** + * @brief DEPRECATED + */ + UFR_STATUS DL_API uFR_i_block_transceiveM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR size_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint32_t *ufr_status); + /** + * @brief Multi reader support. + * Used to transmit C-APDU and receive R-APDU packets per defined parameters + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls APDU CLA (class byte) + * @param ins APDU command code (instruction byte) + * @param p1 parameter byte + * @param p2 parameter byte + * @param data_out APDU command data field. Use NULL if data_out_len is 0 + * @param data_out_len number of bytes in the APDU command data field (Lc field) + * @param data_in buffer for receiving APDU response. There should be allocated at least (send_le + 2) bytes before function call. + * @param max_data_in_len size of the receiving buffer. If the APDU response exceeded size of buffer, then function returns error + * @param response_len value of the Le fied if send_le is not 0. After successful execution location pointed by the response_len will contain number of bytes in the APDU response. + * @param send_le if this parameter is 0 then APDU Le field will not be sent. Otherwise Le field will be included in the APDU message. Value response_len pointed to, before function call will be value of the Le field. + * @param apdu_status APDU error codes SW1 and SW2 in 2 bytes array + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_TransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN uint8_t *data_out, + uint8_t data_out_len, OUT uint8_t *data_in, uint32_t max_data_in_len, VAR uint32_t *response_len, + uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * Sends C–APDU in the c_string (zero terminated) format, containing pairs of the + hexadecimal digits. Pairs of the hexadecimal digits can be delimited by any of the punctuation + characters or white space. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu C_APDU as string + * @param r_apdu R_APDU returned as string + * + * @return Operation status + */ + UFR_STATUS DL_API APDUHexStrTransceiveM(UFR_HANDLE hndUFR, IN const char *c_apdu, OUT char **r_apdu); + + /** + * @brief Multi reader support. + * Binary alternative function to the APDUHexStrTransceive(). C-APDU and R-APDU are + sent and receive in the form of the byte arrays. There is obvious need for a c_apdu_len and + *r_apdu_len parameters which represents length of the *c_apdu and *r_apdu byte arrays, + respectively + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, OUT uint8_t *r_apdu, + VAR uint32_t *r_apdu_len); + + /** + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param c_apdu Array containing the C-APDU + * @param c_apdu_len length of the c_apdu array + * @param r_apdu Array containing received R-APDU + * @param r_apdu_len length of the received r_apdu array + * + * @return Operation status + */ + UFR_STATUS DL_API APDUPlainTransceiveToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *c_apdu, uint32_t c_apdu_len, VAR uint8_t **r_apdu, VAR uint32_t *r_apdu_len); + + /** + * @brief Multi reader support. + * This is “exploded binary” alternative function intended for support APDU commands in ISO 14443- + 4A tags. APDUTransceive() receives separated parameters which are an integral part of the C– + APDU. There are parameters cls, ins, p0, p1 of the uint8_t type. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param cls lcs + * @param ins ins + * @param p1 p1 + * @param p2 p2 + * @param data_out data_out + * @param Nc Nc + * @param data_in data_in + * @param Ne Ne + * @param send_le send_le + * @param apdu_status apdu_status + * + * @return Operation status + */ + UFR_STATUS DL_API APDUTransceiveM(UFR_HANDLE hndUFR, uint8_t cls, uint8_t ins, uint8_t p1, uint8_t p2, IN const uint8_t *data_out, + uint32_t Nc, OUT uint8_t *data_in, VAR uint32_t *Ne, uint8_t send_le, OUT uint8_t *apdu_status); + + /** + * @brief Multi reader support. + * I-block used to convey information for use by the application layer + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param chaining 1 - chaining in use, 0 - no chaining + * @param timeout timeout for card reply + * @param block_length inf block length + * @param snd_data_array pointer to array of data that will be send + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API i_block_trans_rcv_chainM(UFR_HANDLE hndUFR, uint8_t chaining, uint8_t timeout, uint8_t block_length, + IN uint8_t *snd_data_array, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * R-block used to convey positive or negative acknowledgements. An R-block never contains an INF field. The acknowledgement relates to the last received block. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param ack 1 ACK, 0 NOT ACK + * @param timeout timeout for card reply + * @param rcv_length length of received data + * @param rcv_data_array pointer to array of data that will be received + * @param rcv_chained 1 received packet is chained, 0 received packet is not chained + * @param ufr_status card operation status + * + * @return Operation status + */ + UFR_STATUS DL_API r_block_transceiveM(UFR_HANDLE hndUFR, uint8_t ack, uint8_t timeout, VAR uint8_t *rcv_length, OUT uint8_t *rcv_data_array, + VAR uint8_t *rcv_chained, VAR uint32_t *ufr_status); + + /** + * @brief Multi reader support. + * Used to deselect tag and restore RF field polling. This call is mandatory after using SetISO14443_4_Mode() and its variants. + * + * @ingroup Card_Tag_CardFeatures_ISO144434_4_M + * + * @param hndUFR handle of the uFR device + * @param timeout timeout in [ms] + * + * @return Operation status + */ + UFR_STATUS DL_API s_block_deselectM(UFR_HANDLE hndUFR, uint8_t timeout); + + /** + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param card_activate card_activate + * @param card_halted card_halted + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param crypto1 crypto1 + * @param timeout timeout + * @param tx_data tx_data + * @param tx_data_len tx_data_len + * @param rx_data rx_data + * @param rx_data_len rx_data_len + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceiveM(UFR_HANDLE hndUFR, uint8_t card_activate, uint8_t card_halted, uint8_t tx_crc, uint8_t rx_crc, + uint8_t crypto1, uint32_t timeout, IN uint8_t *tx_data, uint8_t tx_data_len, OUT uint8_t *rx_data, + VAR uint8_t *rx_data_len); + + /** + * @brief Multi reader support. Function sets the parameters for transceive mode. If the hardware CRC option is used, then only command bytes are sent to the card (hardware will add two bytes of CRC to the end of the RF packet). If this option did not use, then command bytes and two bytes of CRC sent to card (i.e. ISO14443 typeA CRC). Timeout for card response in us sets. + * Card is selected and waiting for commands. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param tx_crc hardware RF TX crc using (1 - yes, 0 - no) + * @param rx_crc hardware RF RX crc using (1 - yes, 0 - no) + * @param rf_timeout timeout for card response in us + * @param uart_timeout timeout for UART response in ms + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_startM(UFR_HANDLE hndUFR, uint8_t tx_crc, uint8_t rx_crc, uint32_t rf_timeout, uint32_t uart_timeout); + + /** + * @brief Multi reader support. + * The function returns the reader to normal mode. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_transceive_mode_stopM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function enables normal working mode of reader, after leaving the transceive working mode with blocking card HALT command in the main loop. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API card_halt_enableM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function sends data through the serial port to the card. + * + * @ingroup Card_Tag_CardFeatures_TransceiveMode_M + * + * @param hndUFR handle of the uFR device + * @param send_data pointer to data array for sending to card + * @param send_len number of bytes for sending + * @param rcv_data pointer to data array received from card + * @param bytes_to_receive expected number of bytes received from card + * @param rcv_len number of bytes received from card + * + * @return Operation status + */ + UFR_STATUS DL_API uart_transceiveM(UFR_HANDLE hndUFR, IN uint8_t *send_data, uint8_t send_len, OUT uint8_t *rcv_data, + uint32_t bytes_to_receive, VAR uint32_t *rcv_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * After the successfully executed function, the same APDU commands as for ISO14443-4 tags can be used, but not at the same time. + * Note. This function is used for NXP SAM AV2 activation, and unlocking if SAM is locked. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API open_ISO7816_interfaceM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function activates the smart card and returns an ATR (Answer To Reset) array of bytes from the smart card. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * @param atr_data pointer to array containing ATR + * @param atr_len pointer to ATR length variable + * + * @return Operation status + */ + UFR_STATUS DL_API Open_ISO7816_GenericM(UFR_HANDLE hndUFR, OUT uint8_t *atr_data, VAR uint8_t *atr_len); + + /** + * @brief Multi reader support. + * Function switches the use of APDU to ISO7816 interface. The smart card must be in the active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are not used. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_no_APDUM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function deactivates the smart card. APDU commands are used by ISO 14443-4 tags. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API close_ISO7816_interface_APDU_ISO14443_4M(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Function switches the use APDU to ISO14443-4 tags. The smart card stays in active state. Tag must already be in ISO 14443-4 mode. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_to_ISO14443_4_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * APDU commands are not used. The smart card stays in active state. + * + * @ingroup Card_Tag_CardFeatures_ISO7816_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API APDU_switch_off_from_ISO7816_interfaceM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. + * Using this function you can select the appropriate application on the card. For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param aid Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. + * @param aid_len Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). + * @param selection_response On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSelectByAidM(UFR_HANDLE hndUFR, IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]); + + /** + * @brief Multi reader support. In JCApp cards you can put two types of asymmetric crypto keys. Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param key_type 0 for RSA private key and 1 for ECDSA private key. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param key Pointer to array containing key bytes. + * @param key_bit_len Key length in bits. + * @param key_param Reserved for future use (RFU). Use null for this parameter. + * @param key_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutPrivateKeyM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, + const IN uint8_t *key_param, uint16_t key_parm_len); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_type key_type + * @param key_index key_index + * @param key_designator key_designator + * @param key_bit_len key_bit_len + * @param params params + * @param params_size params_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateKeyPairM(UFR_HANDLE hndUFR, uint8_t key_type, uint8_t key_index, uint8_t key_designator, + uint16_t key_bit_len, IN const uint8_t *params, uint16_t params_size); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteRsaKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppDeleteEcKeyPairM(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param chunk Pointer to array containing first chunk of data. + * @param chunk_len Length of the first chunk of data (max. 255). + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureBeginM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *chunk, uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param chunk Pointer to an array containing one of the chunks of data. + * @param chunk_len Length of the current one of the remaining chunks of data (max. 255). + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureUpdateM(UFR_HANDLE hndUFR, IN const uint8_t *chunk, uint16_t chunk_len); + + /** + * @brief Multi reader support. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param sig_len Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppSignatureEndM(UFR_HANDLE hndUFR, VAR uint16_t *sig_len); + + /** + * @brief Multi reader support. + * This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with a User PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param cipher 0 for the RSA private key and 1 for the ECDSA. + * @param digest 0 for none digest (not supported with ECDSA) and 1 for SHA1 + * @param padding 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. + * @param key_index For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. + * @param plain_data Pointer to array containing data for signing. + * @param plain_data_len Length of the data for signing (max. 255). + * @param sig_len Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. + * @param alg_param Reserved for future use (RFU). Use null for this parameter. + * @param alg_parm_len Reserved for future use (RFU). Use 0 for this parameter. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGenerateSignatureM(UFR_HANDLE hndUFR, uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, + IN const uint8_t *plain_data, uint16_t plain_data_len, VAR uint16_t *sig_len, + IN const uint8_t *alg_param, uint16_t alg_parm_len); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj Pointer to an array containing an object (certificate). + * @param obj_size Length of the object (certificate). + * @param id Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. + * @param id_size Length of the object id. Minimum object id length can be 1 and maximum 253. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, + uint8_t id_size); + + /** + * @brief Multi reader support. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling of this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. + * @param size Length of the subject. Maximum subject length is 255. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPutObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size); + + /** + * @brief Multi reader support. + * Using this function you can delete certificate objects from a card. This includes subjects linked to a certificate. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppInvalidateCertM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index); + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param id When id == NULL, the function returns id_size. + * @param id_size Before second call, *id_size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjIdM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size); // when id == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param subject When subject == NULL, function returns size. + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjSubjectM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size); // when subject == NULL returns size + + /** + * @brief Multi reader support. + * This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. + * Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * + * @param hndUFR handle of the uFR device + * @param obj_type 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). + * @param obj_index For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. + * @param obj When obj == NULL, function returns size + * @param size Before second call, *size should be set to a value of the exact bytes allocated. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetObjM(UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size); // when obj == NULL returns size + + /** + * @brief Multi reader support. + * This function is used to login to the JCApp with an appropriate PIN code. Every time you deselect the JCApp tag either by calling s_block_deselect(), ReaderReset(), ReaderClose() or because of the loss of the NFC field, in order to communicate with the same tag you have to select JCApp and login again, using this function. + * Every successful login resets the incorrectly entered PIN code counter for the PIN code specified by the SO parameter. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to login as a User. If this parameter has a value different then 0, the function will try to login as a Security Officer (SO). + * @param pin Pointer to the array of bytes which contains PIN code. + * @param pinSize Effective size of the array of bytes which contains PIN code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppLoginM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *pin, uint8_t pinSize); + + /** + * @brief Multi reader support. This function is used to get how many of the unsuccessful login attempts remain before specified PIN or PUK code will be blocked. + * This function have parameter of the type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN code type (see the dl_sec_code_t type definition above, in the text) + * @param triesRemaining Pointer to the 16-bit unsigned integer which will contain the number of the unsuccessful login attempts remains before specified PIN code will be blocked, in case of successful function execution. If this value is 0 then the specified PIN code is blocked. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetPinTriesRemainingM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, VAR uint16_t *triesRemaining); + + /** + * @brief Multi reader support. This function is used to change the PIN or PUK code which type is specified with secureCodeType parameter of type dl_sec_code_t which is defined as: + * typedef enum { + * USER_PIN = 0, + * SO_PIN, + * USER_PUK, + * SO_PUK + * } dl_sec_code_t; + * Prior to calling this function you have to be logged in with an SO PIN code. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param secureCodeType Specifies the PIN or PUK code type you wish to change (see the dl_sec_code_t type definition above, in the text) + * @param newPin Pointer to the array of bytes which contains a new code + * @param newPinSize Effective size of the array of bytes which contains a new code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinChangeM(UFR_HANDLE hndUFR, dl_sec_code_t secureCodeType, IN uint8_t *newPin, uint8_t newPinSize); + + /** + * @brief Multi reader support. + * This function is used to unblock PIN code which is specified by the SO parameter. + * This function does not require to be logged in with any of the PIN codes. + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * + * @param hndUFR handle of the uFR device + * @param SO If this parameter has value 0 function will try to unblock User PIN code. If this parameter has a value different then 0, the function will try to unblock SO PIN code. + * @param puk Pointer to the array of bytes which contains PUK code. + * @param pukSize Effective size of the array of bytes which contains PUK code. + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinUnblockM(UFR_HANDLE hndUFR, uint8_t SO, IN uint8_t *puk, uint8_t pukSize); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinEnableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_Common_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param SO SO + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppPinDisableM(UFR_HANDLE hndUFR, uint8_t SO); + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param modulus modulus + * @param modulus_size modulus_size + * @param exponent exponent + * @param exponent_size exponent_size + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetRsaPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *modulus, VAR uint16_t *modulus_size, + OUT uint8_t *exponent, VAR uint16_t *exponent_size); // when modulus == NULL, returns sizes and exponent ignored + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param keyW keyW + * @param keyWSize keyWSize + * @param field field + * @param field_size field_size + * @param ab ab + * @param ab_size ab_size + * @param g g + * @param g_size g_size + * @param r r + * @param r_size r_size + * @param k k + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcPublicKeyM(UFR_HANDLE hndUFR, uint8_t key_index, OUT uint8_t *keyW, VAR uint16_t *keyWSize, OUT uint8_t *field, + VAR uint16_t *field_size, OUT uint8_t *ab, VAR uint16_t *ab_size, OUT uint8_t *g, + VAR uint16_t *g_size, OUT uint8_t *r, VAR uint16_t *r_size, VAR uint16_t *k, + VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); // when keyW == NULL, returns size + + /** + * + * @ingroup Card_Tag_JavaCardApplication_PKIAndDigitalSignature_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_index key_index + * @param key_size_bits key_size_bits + * @param key_designator key_designator + * + * @return Operation status + */ + UFR_STATUS DL_API JCAppGetEcKeySizeBitsM(UFR_HANDLE hndUFR, uint8_t key_index, VAR uint16_t *key_size_bits, VAR uint16_t *key_designator); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * This function has to be called before JCStorageListFiles() to acquire the size of the array of bytes needed to be allocated for the list of currently existing files on the DLStorage card. Maximum files on the DLStorage card is 16. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list_size Pointer to the 32-bit unsigned integer which will contain the size of the array of bytes needed to be allocated prior to calling the JCStorageListFiles() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFilesListSizeM(UFR_HANDLE hndUFR, VAR uint32_t *list_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFilesListSize() function and getting the size of the list of the currently existing files on the DLStorage card, and if the list size is greater than 0, you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the list parameter will contain indexes of the existing files on the card. Maximum files on the DLStorage card is 16. Each byte of the array pointed by the list parameter contains a single index of the existing file on the DLStorage card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param list Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFilesListSize() function. + * @param list_bytes_allocated Size of the array of bytes pointed by the list parameter. Have to be equal to the value of the *list_size acquired by the previous call to JCStorageGetFilesListSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageListFilesM(UFR_HANDLE hndUFR, OUT uint8_t *list, uint32_t list_bytes_allocated); + + /** + * @brief Multi reader support. + * This function returns file size indexed by the parameter card_file_index, on successful execution. Returned file size is in bytes. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. You have to know file size to allocate an appropriate amount of data prior to calling the JCStorageReadFile() function. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file which size we want to get + * @param file_size Pointer to the 32-bit unsigned integer which will contain size in bytes of the file having card_file_index. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageGetFileSizeM(UFR_HANDLE hndUFR, uint8_t card_file_index, VAR uint32_t *file_size); + + /** + * @brief Multi reader support. + * After calling the JCStorageGetFileSize() function and getting the size of the file on the DLStorage card you can allocate a convenient array of bytes and then call this function. On successful function execution, the array pointed by the data parameter will contain file content. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param data Pointer to the allocated array of bytes of the size acquired by the previous call to JCStorageGetFileSize() function. + * @param data_bytes_allocated d Size of the array of bytes pointed by the data parameter. Have to be equal to the value of the *file_size acquired by the prior calling JCStorageGetFileSize() function. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, OUT uint8_t *data, uint32_t data_bytes_allocated); + + /** + * @brief Multi reader support. + * This function reads a file from the DLStorage card directly to the new file on the host file-system. If the file on the host file system already exists, it will be overwritten. If the file with the index defined by the card_file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to read. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the new file on the host file-system which will contain the data read from the file on the card in case of successful function execution. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageReadFileToFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * This function creates a file on the DLStorage card and writes an array of bytes pointed by the data parameter to it. Parameter data_size defines the amount of data to be written in the file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file we want to create and write data to it. + * @param data Pointer to the data i.e. array of bytes to be written into the new file on the card. + * @param data_size Size, in bytes, of the data to be written into the file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const uint8_t *data, uint32_t data_size); + + /** + * @brief Multi reader support. + * This function writes file content from the host file-system to the new file on the DLStorage card. If the file with the index defined by the card_file_index parameter already exists on the card, the function will return UFR_APDU_SW_ENTITY_ALREADY_EXISTS (0x000A6A89) error code. Maximum files on the DLStorage card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If there is an error during the writing procedure, for example because of the loss of the NFC field and the file is only partially written (tearing event), a corrupted file on the DLStorage card should be deleted and then written again. Therefore we suggest you to always do verification of the data written to the card. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param card_file_index It should contain an index of the file on the card we want to create and write content of the file from the host file-sistem to it. + * @param file_system_path_name Pointer to the null-terminated string that should contain path and the name of the file from the host file-sistem whose content we want to transfer to the new file on the card. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageWriteFileFromFileSystemM(UFR_HANDLE hndUFR, uint8_t card_file_index, IN const char *file_system_path_name); + + /** + * @brief Multi reader support. + * After successful call to this function, the file on the DLStorage card will be deleted. Maximum files on the card is 16 and file indexes are zero-based so indexes can be in the range of 0 to 15. If a file with index defined by the file_index parameter does not exist, the function will return UFR_APDU_SW_FILE_NOT_FOUND (0x000A6A82) error code. + * + * @ingroup Card_Tag_JavaCardApplication_DLStorage_M + * + * @param hndUFR handle of the uFR device + * @param file_index It should contain an index of the file we want to delete. + * + * @return Operation status + */ + UFR_STATUS DL_API JCStorageDeleteFileM(UFR_HANDLE hndUFR, uint8_t file_index); + + //------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. + * Use this function to authenticate to the eMRTD NFC tag using BAC. This function establishes a security channel for communication. Security channel is maintained using send_sequence_cnt parameter and channel session keys are ksenc (for encryption) and ksmac (for calculating MAC). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param mrz_proto_key MRZ proto-key acquired using prior call to MRTD_MRZDataToMRZProtoKey() or MRTD_MRZSubjacentToMRZProtoKey() function. + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt After successful execution of this function, the pointer to this 64-bit value should be saved and forwarded at every subsequent call to MRTDFileReadBacToHeap() and/or other functions for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDAppSelectAndAuthenticateBacM(UFR_HANDLE hndUFR, IN const uint8_t mrz_proto_key[25], OUT uint8_t ksenc[16], + OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * Use this function to read files from the eMRTD NFC tag. You can call this function only after successfully established security channel by the previously called + * MRTDAppSelectAndAuthenticateBac() function. Session keys ksenc and ksmac, and also parameter send_sequence_cnt are acquired by the previously called + * MRTDAppSelectAndAuthenticateBac() function. After the successful call to this function, *output points to the file data read from an eMRTD file specified by the file_index parameter. Buffer, in which the data is stored, is automatically allocated on the memory heap during function execution. Maximum amount of data allocated can be 32KB. User is obligated to cleanup allocated data space, occupied by the *output, after use (e.g. by calling DLFree() or directly free() from the C/C++ code). + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param file_index file index + * @param output buffer that storese output + * @param output_length length of the returned output + * @param ksenc This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session encryption key after successful function execution. + * @param ksmac This array must have allocated at least 16 bytes prior to calling this function. This array will contain a session key for calculating MAC after successful function execution. + * @param send_sequence_cnt send_sequence_cnt + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDFileReadBacToHeapM(UFR_HANDLE hndUFR, IN const uint8_t *file_index, VAR uint8_t **output, OUT uint32_t *output_length, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Extracts Document Signing (DS) certificate in ASN.1 DER format from SOD. + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param[in] hndUFR The handle to the uFR reader. + * @param[out] cert A pointer to a uint8_t pointer. This will point to the allocated memory containing the + * certificate (ASN.1 DER format). The user is responsible for freeing this memory using DLFree() + * after use. + * @param[out] certlen A pointer to a uint32_t that will store the length of the certificate. + * @param[in] ksenc A uint8_t array of size 16 containing the encryption key. + * @param[in] ksmac A uint8_t array of size 16 containing the MAC key. + * @param[in,out] send_sequence_cnt A pointer to a uint64_t that keeps track of the send sequence counter. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTD_SOD_CertToHeapM(UFR_HANDLE hndUFR, VAR uint8_t **cert, VAR uint32_t *certlen, + IN const uint8_t ksenc[16], IN const uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + + /** + * @brief Multi reader support. + * This function validates data groups read from the eMRTDocument. All the elements needed for a validation are recorded into the eMRTD and additional CSCA certificate (Country Signing Certificate Authority). During function execution, hash values of the data groups are validated. Data groups hash values have to be the same as those values embedded in the SOD file which is signed by the private key corresponding to the DS certificate. The DS certificate has to be included in the SOD file too. SOD content is a special case of the PKCS#7 ASN.1 DER encoded structure. Finally, DS certificate signature is validated by the external CSCA certificate which is proof of the valid certificates chain of thrust. + * The countries provided their CSCA certificates on the specialized Internet sites. CSCA certificates can be in PEM (base64 encoded) or binary files (there having extensions such as PEM, DER, CER, CRT…). Some countries have Master List files that include certificates from other countries with which they have bilateral agreements. Those Master List files have an “.ml” file extension. Additionally, the ICAO Public Key Directory (PKD) is a central repository for exchanging the information required to authenticate ePassports. For more details you can visit the ICAO PKD web site. + * ________________ + * + * @ingroup Card_Tag_CardFeatures_MRTD_M + * + * @param hndUFR handle of the uFR device + * @param cert_storage_folder Pointer to the zero terminated string which should contains path to the folder containing CSCA certificates and/or ICAO Master List files. + * @param out_str After successful function execution, this pointer will point to the pointer on the zero terminated string containing verbose printout of the validation steps. Various printout details are determined by the value of the verbose_level function parameter. + * @param endln Pointer to the zero terminated string which contains the new line escape sequence for the target system. In the general case it should be "\n" but on some systems can be "\r" or "\r\n". + * @param verbose_level One of the values defined in the E_PRINT_VERBOSE_LEVELS enumeration: enum E_PRINT_VERBOSE_LEVELS { PRINT_NONE, PRINT_ESSENTIALS, PRINT_DETAILS, PRINT_ALL_PLUS_STATUSES, }; + * @param ksenc Session encryption key acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param ksmac Session key for calculating MAC acquired using prior call to MRTDAppSelectAndAuthenticateBac() function. + * @param send_sequence_cnt This pointer should point to a 64-bit value initialized by the previously successful call to MRTDAppSelectAndAuthenticateBac() function. Pointer to this 64-bit value should be saved and forwarded at every subsequent call to this function and/or other functions used for reading eMRTD. + * + * @return Operation status + */ + UFR_STATUS DL_API MRTDValidateM(UFR_HANDLE hndUFR, IN const char *cert_storage_folder, VAR char **out_str, IN const char *endln, + uint32_t verbose_level, OUT uint8_t ksenc[16], OUT uint8_t ksmac[16], VAR uint64_t *send_sequence_cnt); + // ############################################################################# + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Start(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StartM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_Stop(void); + + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_DESFIRE_StopM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Start(void); // Alias for uFR_DESFIRE_Start() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StartM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StartM() + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_Stop(void); // Alias for uFR_DESFIRE_Stop() + /** + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_APDU_StopM(UFR_HANDLE hndUFR); // Alias for uFR_DESFIRE_StopM() + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUidM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, OUT uint8_t *card_uid, + VAR uint8_t *card_uid_len, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3desM(UFR_HANDLE hndUFR, IN uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * Provided Key mode (PK) + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit AES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 64 bit DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_GetDesfireUid_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUidDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief This function returns Unique ID of card, if the Random ID is used. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Mifare Desfire EV1 card can be configured to use Random ID numbers instead Unique ID numbers during anti-collision procedure. In this case card uses single anti-collision loop, and returns Random Number Tag 0x08 and 3 bytes Random Number (4 bytes Random ID). + * From library version 5.0.29. and firmware version 5.0.32, Desfire Light card supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_nr key number into application (0 for card master key or application master key) + * @param card_uid pointer to array containing card UID + * @param card_uid_len pointer to card UID length variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_GetDesfireUid2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, VAR uint8_t *card_uid_len, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function returns the available bytes on the card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param free_mem_byte pointer to free memory size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFreeMemM(UFR_HANDLE hndUFR, VAR uint32_t *free_mem_byte, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCardM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * Provided Key mode (PK) + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit AES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 64 bit DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireFormatCard_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCardDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function releases all allocated user memory on the card. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * All applications will be deleted, also all files within those applications will be deleted. Only the card master key, and card master key settings will not be deleted. This operation requires authentication with the card master key. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireFormatCard2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [a] + * @param write_key_no key for writing [b] + * @param read_write_key_no key for reading and writing [c] + * @param change_key_no key for changing this setting [d] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.81. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [i] + * @param write_key_no key for writing [j] + * @param read_write_key_no key for reading and writing [k] + * @param change_key_no key for changing this setting [l] + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + /** + * @brief Multi reader support. Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Provided Key mode (PK) + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Desfire EV3 only. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 – 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * Secure Dynamic Message can be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. Communication settings define communication mode between reader and card. The communication modes are: - plain communication communication settings value is 0x00 - plain communication secured by MACing communication settings value is 0x01 - fully enciphered communication communication settings value is 0x03 Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, uint16_t iso_file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. From library version 5.0.96, and firmware version 5.0.81. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * ISO/IEC 7816-4 File ID for the file to be created. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param iso_file_id ISO/IEC 7816-4 File ID for the file to be created + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateStdDataFile_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, uint16_t iso_file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t file_size, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Function allows to create a file for the storage of unformatted user data within an existing application on the card. Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain keys within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If the value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * Due to the mirror image a BackupDataFile always consumes double quantity of the card’s memory compared to a StandardDataFile with the same specified file size. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param file_size file size in bytes + * @param read_key_no key for reading [m] + * @param write_key_no key for writing [n] + * @param read_write_key_no key for reading and writing [o] + * @param change_key_no key for changing this setting [p] + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t file_size, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * Provided Key mode (PK) + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit AES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 64 bit DES key provided key + * Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 128 bit 2K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * 192 bit 3K3DES key provided key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function deactivates a file within the currently selected application. + * + * Multi reader support. + * No authentication + * Allocated memory blocks associated with deleted file not set free. Only format card function can delete the memory blocks. Is the application master key authentication is required, depending on the application master key settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit AES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 192 bit 3K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 64 bit DES key provided key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. No authentication + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_isoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_isoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_isoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_isoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + // 121212 + /** + * @brief Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_aes_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_des_iso_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief From library version 5.0.97, and firmware version 5.0.81. + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreate3k3desApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name pointer to ISO/IEC 7816-4 DF Name array + * @param iso_df_name_len length of the ISO/IEC 7816-4 DF Name array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateDesApplication_no_auth_isoM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create a new application on the card. + * + * If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * Multi reader support + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support + * Function allows to create a new application on the card. If the card master key authentication is required, depending on the card master key settings. Maximal number of applications on the card is 28. Each application is linked to a set of up 14 different user definable access keys. + * ISO/IEC 7816-4 File Identifier, and ISO/IEC 7816-4 DF Name for this application must be defined. + * Application specific Capability data enabled. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param setting application master key settings + * @param max_key_no maximal number of keys into application (1 to 14) + * @param iso_file_id ISO/IEC 7816-4 File Identifier + * @param iso_df_name ISO/IEC 7816-4 DF (Dedicated File) name + * @param iso_df_name_len DF name length + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, uint8_t max_key_no, + uint16_t iso_file_id, IN uint8_t *iso_df_name, uint8_t iso_df_name_len, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplicationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplicationd2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. Provided Key mode (PK) + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit AES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 64 bit DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to deactivate application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Is the authentication with card master key or with the application master key is required, depending on the card master key settings. AID allocation is removed, but deleted memory blocks can only recovered by using Format card function. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfigurationM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. Provided Key mode (PK) + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit AES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 64 bit DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 128 bit 2K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. 192 bit 3K3DES key provided key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetConfiguration_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfigurationDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint8_t random_uid, uint8_t format_disable, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to activate the Random ID option, and/or Format disable option. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * If these options are activated, then they can not be returned to the factory setting (Random ID disabled, Format card enabled). This operation requires authentication with the card master key. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param random_uid 0 - Random ID disabled, 1 - Random ID enabled + * @param format_disable 0 - Format enabled, 1 - Format disabled + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetConfiguration2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint8_t random_uid, + uint8_t format_disable, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting application key settings + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, VAR uint8_t *setting, + VAR uint8_t *max_key_no, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to get card master key and application master key configuration settings. + * + * Multi reader support. No authentication + * In addition it returns the maximum number of keys which can be stored within the selected application. Is authentication with the master key required, depending on the master key setting. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param max_key_no maximum number of keys within selected application + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetKeySettings_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, + VAR uint8_t *setting, VAR uint8_t *max_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Function allows to set card master key, and application master key configuration settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettingsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. Provided Key mode (PK) + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeKeySettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to set card master key, and application master key configuration settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param setting pointer to settings variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeKeySettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t setting, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr ordinal number of AES key in the reader + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr ordinal number of AES key in the reader + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key_nr ordinal number of authentication DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_desM(UFR_HANDLE hndUFR, uint8_t auth_des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_2k3des_key_nr, uint8_t aid_key_no, uint8_t old_2k3des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key_nr key index of 2K3DES key stored in the reader that will be new 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key_nr key index of 2K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_des2k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_2k3des_key_nr, uint8_t aid_key_no, + uint8_t old_2k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key_nr ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_des3k_key_nr, uint32_t aid, + uint8_t aid_key_no_auth, uint8_t new_3k3des_key_nr, uint8_t aid_key_no, + uint8_t old_3k3des_key_nr, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of the key stored in the reader + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. 128 bit AES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key 16 bytes array that represent AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key 16 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeAesKey_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_aes_key[16], uint8_t aid_key_no, IN uint8_t old_aes_key[16], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, uint8_t aid_key_no_auth, + IN uint8_t new_des_key[8], uint8_t aid_key_no, IN uint8_t old_des_key[8], + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 64 bit DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des_key pointer to 8 bytes array containing the DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key 8 bytes array that represent DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key 8 bytes array that represent current AES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeDesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_des_key[8], uint8_t aid_key_no, + IN uint8_t old_des_key[8], VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des2k_key ordinal number of authentication 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_2k3des_key 16 bytes array that represent 2K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_2k3des_key 16 bytes array that represent current 2K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange2K3DesKey_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des2k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_2k3des_key[16], uint8_t aid_key_no, + IN uint8_t old_2k3des_key[16], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_des3k_key pointer to 32 bytes array containing the 3K3DES key + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_3k3des_key 24 bytes array that represent 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_3k3des_key 24 bytes array that represent current 3K3DES key that will be changed, if this is not key by which is made authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChange3K3DesKey_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_des3k_key, uint32_t aid, + uint8_t aid_key_no_auth, IN uint8_t new_3k3des_key[24], uint8_t aid_key_no, + IN uint8_t old_3k3des_key[24], VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. Provided Key mode (PK) + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key pointer to array contained new AES key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeMasterKey_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t auth_key_type, IN uint8_t *new_key, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any AES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of authentication AES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_aes_key_nr key index of AES key stored in the reader that will be new AES key + * @param aid_key_no key number into application that will be changed + * @param old_aes_key_nr key index of AES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeAesKey_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_aes_key_nr, uint8_t aid_key_no, uint8_t old_aes_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 3K3DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des3k_key_nr key index of 3K3DES key stored in the reader that will be new 3K3DES key + * @param aid_key_no key number into application that will be changed + * @param old_des3k_key_nr key index of 3K3DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange3k3desKey_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des3k_key_nr, uint8_t aid_key_no, uint8_t old_des3k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any 2K3DES key on the card. + * + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change any DES key on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeDesKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief *only uFR CS with SAM support + * 128 bit 2K3DES key + * Function allows you to change any AES key on the card. Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that uses this key (3 bytes long, 0x000000 for card master key) + * @param aid_key_no_auth key number into application which uses for authentication + * @param new_des2k_key_nr key index of DES key stored in the reader that will be new DES key + * @param aid_key_no key number into application that will be changed + * @param old_des2k_key_nr key index of DES key stored in the reader that will be used for authentication + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChange2k3desKey_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_no_auth, + uint8_t new_des2k_key_nr, uint8_t aid_key_no, uint8_t old_des2k_key_nr, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows you to change master key of the card from any type to any type. + * + * Multi reader support. *only uFR CS with SAM support + * Changing the card master key requires current card master key authentication. Authentication for the application keys changing depends on the application master key settings (which key is used for authentication). + * Important: When changing a card key to a 2K3DES key, the new 2K3DES key must have different first 8 bytes and second 8 bytes. For example, the new 2K3DES key should be: 11111111111111112222222222222222. New 2K3DES key must not consist of all zeros (16 0x00 bytes). + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param auth_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param new_key_nr key index of a key stored in the reader that will be new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t auth_key_type, uint8_t new_key_nr, + uint8_t new_key_type, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief + * Function writes AES key (16 bytes) into reader. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key in the reader (0 - 15) + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteAesKeyM(UFR_HANDLE hndUFR, uint8_t aes_key_no, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Function writes AES key (16 bytes) into reader. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param key_no ordinal number of key in the reader (0 - 15) + * @param key pointer to array containing the key + * @param key_type enumerated key type (0 - 3) + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteKeyM(UFR_HANDLE hndUFR, uint8_t key_no, IN uint8_t *key, uint8_t key_type); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStddDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from Standard Data File, or from Backup Data File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteStdDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to Standard Data File, or to Backup Data File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteStdDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. Provided Key mode (PK) + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit AES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 64 bit DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @param hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to the Backup Data File. + * + * Multi reader support. No authentication + * From library version 5.0.96, and firmware version 5.0.79. + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteBackupDataFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + int32_t lower_limit, int32_t upper_limit, int32_t value, + uint8_t limited_credit_enabled, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for the storage and manipulation of 32 bit signed integer values within existing application on the card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depending on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param lower_limit lower limit which is valid for this file + * @param upper_limit upper limit which is valid for this file + * @param value initial value of the value file + * @param limited_credit_enabled bit 0 - limited credit enabled (1 - yes, 0 - no) bit 1 - free get value (1 - yes, 0 - no) + * @param read_key_no key for get and debit value + * @param write_key_no key for get, debit and limited credit value + * @param read_write_key_no for get, debit, limited credit and credit value + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, int32_t lower_limit, + int32_t upper_limit, int32_t value, uint8_t limited_credit_enabled, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, VAR int32_t *value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allow to read value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value pointer to value + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, VAR int32_t *value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to increase a value stored in a value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only. + * Credit command requires a preceding authentication with the key specified for Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFileM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t aid_key_nr, uint8_t file_id, uint8_t communication_settings, + uint32_t value, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 128 bit 2K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to decrease value from value files. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * Debit command requires a preceding authentication with on of the keys specified for Read, Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param communication_settings variable that contains communication settings + * @param value value (must be a positive number) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint8_t communication_settings, uint32_t value, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + VAR uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIdsM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIdsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetApplicationIds2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. Provided Key mode (PK) + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 128 bit AES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param application_ids pointer to 8 bytes array containing the DES key + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 64 bit DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_2k3aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. 192 bit 3K3DES key provided key + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function returns the Application Identifiers for all active applications on a card. + * + * Multi reader support. No authentication + * For uFR PLUS devices only + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param application_ids array of application identifiers + * @param number_of_aplication_ids number of application identifiers + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetApplicationIds_no_auth_M(UFR_HANDLE hndUFR, OUT uint32_t *application_ids, + VAR uint8_t *number_of_aplication_ids, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file is filled completely with data records, further writing to file is not possible unless it is cleared. + * Maximal number of files into the application is 32. The file will be created in the currently selected application. If the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If the value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateLinearRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit AES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 64 bit DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, + uint32_t record_size, uint32_t max_rec_no, uint8_t read_key_no, + uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, + uint8_t file_id, uint32_t record_size, uint32_t max_rec_no, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, + uint8_t change_key_no, uint8_t communication_settings, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to create file for multiple storage of structural data, within an existing application. + * + * Multi reader support. No authentication + * Once the file filled completely with data records, the card automatically overwrites the oldest record with latest written one. + * Maximal number of files into application is 32. The file will be created in the currently selected application. Is the application master key authentication is required, depend on the application master key settings. + * Communication settings define communication mode between reader and card. The communication modes are: + * - plain communication communication settings value is 0x00 + * - plain communication secured by MACing communication settings value is 0x01 + * - fully enciphered communication communication settings value is 0x03 + * Access rights for read, write, read&write and changing, references certain key within application's keys (0 - 13). If value is 14, this means free access, independent of previous authentication. If value is 15, this means deny access (for example if write access is 15 then the file type is read only). + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param record_size size of record in bytes + * @param max_rec_no maximal number of records in file + * @param read_key_no key for reading + * @param write_key_no key for writing + * @param read_write_key_no key for reading and writing + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateCyclicRecordFile_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, uint32_t record_size, + uint32_t max_rec_no, uint8_t read_key_no, uint8_t write_key_no, + uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t communication_settings, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, uint8_t communication_settings, uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecordDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, uint8_t communication_settings, + IN uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t data_length, uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows writing data to a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Write command requires a preceding authentication either with the key specified for Write or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation is supported for Desfire Light and Desfire EV2. To use these features, a Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param data_length number of bytes into array number of data to be read + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireWriteRecord_TransMac_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t data_length, + uint8_t communication_settings, IN uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, + uint8_t file_id, uint16_t offset, uint16_t number_of_records, uint16_t record_size, + uint8_t communication_settings, OUT uint8_t *data, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, uint16_t offset, + uint16_t number_of_records, uint16_t record_size, uint8_t communication_settings, + uint8_t *data, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecordsDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireReadRecords2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit AES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 64 bit DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + OUT uint8_t *data, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows to read data from a record in a Linear Record File or Cyclic Record File. + * + * Multi reader support. No authentication + * Read command requires a preceding authentication either with the key specified for Read or Read&Write access. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param offset start position for read operation within file + * @param number_of_records number of records to be read + * @param record_size size of record in bytes + * @param communication_settings variable that contains communication settings + * @param data pointer to data array + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireReadRecords_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + uint16_t offset, + uint16_t number_of_records, + uint16_t record_size, + uint8_t communication_settings, + uint8_t *data, + uint16_t *card_status, + uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_no_authM(UFR_HANDLE hndUFR, + uint32_t aid, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileAesAuth_2M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFileDesAuth_2M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile2k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile3k3desAuth_2M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. Provided Key mode (PK) + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_aes_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_2k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_3k3des_PK_2M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t aid_key_nr, + uint8_t file_id, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aesM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_desM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3desM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3desM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit AES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 64 bit DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 128 bit 2K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. 192 bit 3K3DES key provided key + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t aid_key_nr, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function allows to reset a Linear Record File or Cyclic Record file to the empty state. + * + * Multi reader support. No authentication + * Clear command requires a preceding authentication with the key specified for Read&Write access. + * Bug fix from library version 5.0.29. The aid key number was omitted in function parameters, so it was used application master key number 0 for Read&Write access. For compatibility reasons old functions were retained. New function names have the “_2” suffix. + * From library version 5.0.29 and firmware version 5.0.32, Desfire Light supported. + * NOTE: Transaction MAC file exist by factory default setting. For using this function, user must delete transaction MAC file first. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. Function returns current Reader ID if they used, Previous Encrypted Reader ID, Transaction MAC counter, and Transaction MAC. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * @param use_reader_id 0 - Reader ID is not used, 1- Reader ID is used + * @param reader_id pointer to 16 bytes array containing the Reader ID + * @param prev_enc_reader_id pointer to 16 bytes array containing the Previous Encrypted Reader ID + * @param trans_mac_cnt pointer to value of Transaction MAC counter + * @param trans_mac_value pointer to 8 bytes array containing Transaction MAC + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireClearRecordFile_TransMac_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint16_t *card_status, VAR uint16_t *exec_time, + uint8_t use_reader_id, OUT uint8_t *reader_id, OUT uint8_t *prev_enc_reader_id, + OUT uint32_t *trans_mac_cnt, OUT uint8_t *trans_mac_value); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_M(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_M(UFR_HANDLE hndUFR, + uint8_t des_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_M(UFR_HANDLE hndUFR, + uint8_t des2k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_M(UFR_HANDLE hndUFR, + uint8_t des3k_key_nr, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_aes_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *aes_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multireader support. 128 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_2k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des2k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireCreateTransMacFile_3k3des_PK_M(UFR_HANDLE hndUFR, + IN uint8_t *des3k_key_ext, + uint32_t aid, + uint8_t file_id, + uint8_t read_key_no, + uint8_t commit_reader_id_key_no, + uint8_t change_key_no, + uint8_t communication_settings, + IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, + VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileAesAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFileDesAuthM(UFR_HANDLE hndUFR, + uint8_t des_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no ey for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile2k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function creates Transaction MAC file in application. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param read_key_no key for reading + * @param commit_reader_id_key_no key for commit Reader ID command + * @param change_key_no key for changing this setting + * @param communication_settings variable that contains communication settings + * @param trans_mac_key pointer to 16 bytes array containing Transaction MAC key + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireCreateTransMacFile3k3desAuthM(UFR_HANDLE hndUFR, + uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, + uint8_t read_key_no, uint8_t commit_reader_id_key_no, uint8_t change_key_no, + uint8_t communication_settings, IN uint8_t *trans_mac_key, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_no_auth_M(UFR_HANDLE hndUFR, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetStdFileSize_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSizeDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function retrieves the information about the size of the standard data file stored on the tag. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_size pointer to file size variable + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetStdFileSize2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, uint32_t aid, uint8_t file_id, VAR uint32_t *file_size, uint16_t *card_status, uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key provided key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. No authentication + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_no_auth_M(UFR_HANDLE hndUFR, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_des_M(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_2k3des_M(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettings_3k3des_M(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit AES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 64 bit DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. *only uFR CS with SAM support + * 192 bit 3K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param lower_limit value file lower limit + * @param upper_limit value file upper limit + * @param limited_credit_value value file limited credit value + * @param limited_credit_enable value file limited credit enable (0 - disabled, 1 - enabled) + * @param record_size record file size of record + * @param max_number_of_rec record file maximal number of record + * @param curr_number_of_rec record file number of used record + * @param tm_key_type TMC file key type AES + * @param tm_key_version TMC key version + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, + VAR int32_t *lower_limit, VAR int32_t *upper_limit, VAR uint32_t *limited_credit_value, VAR uint8_t *limited_credit_enable, + VAR uint32_t *record_size, VAR uint32_t *max_number_of_rec, VAR uint32_t *curr_number_of_rec, + VAR uint8_t *tm_key_type, VAR uint8_t *tm_key_version, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireGetFileSettingsSdm_aes_M(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function returns file settings. + * + * Multi reader support. + * *only uFR CS with SAM support + * 128 bit 2K3DES key + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_id ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param file_type file type 0 - standard data file, 1 - backup data file, 2 - value file, 3 - linear record file, 4 - cyclic record file, 5 - transaction MAC file + * @param communication_mode communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param file_size standard data file size + * @param sdm_enable Secure Dynamic Messaging enable status + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireGetFileSettingsSdmAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_id, + VAR uint8_t *file_type, VAR uint8_t *communication_mode, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint32_t *file_size, VAR uint8_t *sdm_enable, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_desM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Multi reader support. + * Function allows changing of file settings + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3desM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3desM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_ext pointer to 8 bytes array containing the DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_ext pointer to 16 bytes array containing the 2K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des2k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_ext pointer to 24 bytes array containing the 3K3DES key + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettings_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *des3k_key_ext, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des_key_nr ordinal number of DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsDesAuthM(UFR_HANDLE hndUFR, uint8_t des_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des2k_key_nr ordinal number of 2K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings2k3desAuthM(UFR_HANDLE hndUFR, uint8_t des2k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param des3k_key_nr ordinal number of 3K3DES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file (0 – 31) + * @param comm_settings communication mode 0 - Plain, 1 - MACed, 3 - Enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettings3k3desAuthM(UFR_HANDLE hndUFR, uint8_t des3k_key_nr, + uint32_t aid, uint8_t file_no, uint8_t comm_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireChangeFileSettingsSdm_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function allows changing of file settings + * + * Multi reader support. + * *only uFR CS with SAM support + * Security Dynamic Messaging settings. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param file_no ID of file that will be created (0 - 31) ID of file (0 - 31) + * @param communication_settings communication mode 0 - plain, 1 - maced, 3 - enciphered + * @param read_key_no read key number + * @param write_key_no write key number + * @param read_write_key_no read write key number + * @param change_key_no change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 13, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 13, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 13, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireChangeFileSettingsSdmM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, + uint32_t aid, uint8_t file_no, uint8_t communication_settings, + uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_ext pointer to 16 bytes array containing the AES key + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireSetTransactionTimer_aesM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function set value of application transaction timer. + * + * Multi reader support. + * *only uFR CS with SAM support + * Desfire EV3 only. + * At the current application specific capability data option must be enabled. + * Application must be created by function uFR_int_DesfireCreateAesApplication_aes_iso_ascd. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key in the reader + * @param aid ID of application that contains the file + * @param transaction_timer 0 - disabled, 1 - 1 - 3 seconds, 2 - 10 - 30 seconds, 3 - 100 - 300 seconds + * @param card_status pointer to card error variable + * @param exec_time function's execution time + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_SAM_DesfireSetTransactionTimerAesAuthM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint32_t aid, uint8_t transaction_timer, VAR uint16_t *card_status, VAR uint16_t *exec_time); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). . + * + * Multi reader support. + * From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param lpucECCSignature 56 bytes ECC signature + * @param card_uid 7 bytes length card UID + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireUidReadECCSignatureM(UFR_HANDLE hndUFR, OUT uint8_t *lpucECCSignature, OUT uint8_t *card_uid, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3des_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key provided key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_ext pointer to array containing the key auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aes_PK_M(UFR_HANDLE hndUFR, IN uint8_t *auth_key_ext, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 64 bit DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit 2K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_2k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 192 bit 3K3DES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_3k3desM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + /** + * @brief Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA). + * + * Multi reader support. From library version 5.0.45 and firmware version 5.0.44. For Desfire Light, and Desfire EV2. + * 128 bit AES key + * If the Random ID is activated, then authentication with a valid key is required. + * + * @ingroup Card_Tag_Mifare_Desfire_M + * + * @param hndUFR hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of key in the reader + * @param aid ID of application that contains the file + * @param aid_key_nr key number into application + * @param card_uid 7 bytes length card UID + * @param lpucECCSignature 56 bytes ECC signature + * @param lpucDlogicCardType pointer to variable which will (in case of successfully executed operation) receive DlogicCardType. Returned here for convenience. For DlogicCardType uFR API uses the same constants as with GetDlogicCardType() function (see Appendix: DLogic CardType enumeration). + * + * @return Operation status + */ + UFR_STATUS DL_API uFR_int_DesfireRidReadECCSignature_aesM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint32_t aid, uint8_t aid_key_nr, + OUT uint8_t *card_uid, OUT uint8_t *lpucECCSignature, VAR uint8_t *lpucDlogicCardType); + + //------------------------------------------------------------------------------------------ + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOnM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function prohibits the blinking of the green diode independently of the user's signaling command. LED and sound signaling occurs only on the user command. This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_Signalization_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API GreenLedBlinkingTurnOffM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOnM(UFR_HANDLE hndUFR); + + /** + * @ingroup UNDOCUMENTED + * + * @return Operation status + */ + UFR_STATUS DL_API RgbInternalTurnOffM(UFR_HANDLE hndUFR); + + ///////////////////////////////////////////////////////////////////// + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, uint8_t RFLevelAmp, + uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeADefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBDefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_212DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersISO14443_424DefaultM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeAM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_212M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg RxGain + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersISO14443_424M(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t CWGsNOff, uint8_t ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API SetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, uint8_t ThresholdMinLevel, uint8_t ThresholdCollLevel, + uint8_t RFLevelAmp, uint8_t RxGain, uint8_t RFLevel, uint8_t CWGsNOn, uint8_t ModGsNOn, + uint8_t CWGsP, uint8_t ModGsP); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param CWGsNOff value in range 0 - 15, part of GsNOffReg + * @param ModGsNOff value in range 0 - 15, part of GsNOffReg + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeATransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *CWGsNOff, VAR uint8_t *ModGsNOff); + + /** + * @brief Multi reader support. The function allows the blinking of the green diode independently of the user's signaling command (default setting). This setting writes into the reader's EEPROM, and it loads when the reader starts up. + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_RFAnalogRegisterSettings_M + * + * @param hndUFR handle of the uFR device + * @param ThresholdMinLevel value in range 0 - 15, part of RxThresholdReg + * @param ThresholdCollLevel value in range 0 - 7, part of RxThresholdReg + * @param RFLevelAmp 0 or 1, part of RFCfgReg + * @param RxGain value in range 0 - 7, part of RFCfgReg + * @param RFLevel value in range 0 - 15, part of RFCfgReg + * @param CWGsNOn value in range 0 - 15, part of GsNOnReg + * @param ModGsNOn value in range 0 - 15, part of GsNOnReg + * @param CWGsP value of CWGsPReg (0 - 47) + * @param ModGsP value of ModGsPReg (0 - 47) + * + * @return Operation status + */ + UFR_STATUS DL_API GetRfAnalogRegistersTypeBTransM(UFR_HANDLE hndUFR, VAR uint8_t *ThresholdMinLevel, VAR uint8_t *ThresholdCollLevel, + VAR uint8_t *RFLevelAmp, VAR uint8_t *RxGain, VAR uint8_t *RFLevel, VAR uint8_t *CWGsNOn, + VAR uint8_t *ModGsNOn, VAR uint8_t *CWGsP, VAR uint8_t *ModGsP); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API FastFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API DefaultBaudrateFlashCheckM(UFR_HANDLE hndUFR); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersM(UFR_HANDLE hndUFR, uint8_t *mui, uint8_t *serial_nr, uint8_t *hw_type, uint8_t *hw_ver, + uint8_t *device_type, uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersDefaultBaudrateM(UFR_HANDLE hndUFR, OUT uint8_t *mui, OUT uint8_t *serial_nr, VAR uint8_t *hw_type, VAR uint8_t *hw_ver, + VAR uint8_t *device_type, VAR uint8_t *fw_ver_major, VAR uint8_t *fw_ver_minor, + VAR uint8_t *fw_ver_build); + + /** + * @ingroup INTERNAL + * EXCLUDE FROM DOCUMENTATION + */ + UFR_STATUS DL_API GetReaderParametersPN7462_M(UFR_HANDLE hndUFR, uint8_t *die_id, uint8_t *serial_nr, + + uint8_t *hw_type, uint8_t *hw_ver, uint8_t *device_type, + uint8_t *fw_ver_major, uint8_t *fw_ver_minor, uint8_t *fw_ver_build); + + // SAM + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing version data + * @param length pointer to length variable + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_version_rawM(UFR_HANDLE hndUFR, OUT uint8_t *data, VAR uint8_t *length); + + /** + * @brief Multi reader support. Function returns manufacturing related data of the MIFARE SAM. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param sam_type pointer to SAM type variable + * @param sam_uid pointer to array containing 7 bytes UID + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_versionM(UFR_HANDLE hndUFR, VAR SAM_HW_TYPE *sam_type, VAR uint8_t *sam_uid); + + /** + * @brief Multi reader support. Function allows reading the contents of the key entry specified in the parameter key_no. For more information refer to NXP documentation. + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_entry pointer to array containing key entry data + * @param key_length pointer to key entry length variable + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_get_key_entry_rawM(UFR_HANDLE hndUFR, uint8_t key_no, OUT uint8_t *key_entry, VAR uint8_t *key_length, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_v ADD DESCRIPTION + * @param des_key ADD DESCRIPTION + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_no_div_desM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_v, IN uint8_t *des_key); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_pesonalization_master_AES128_keyM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ver_a, uint8_t ver_a, + IN uint8_t *aes_key_ver_b, uint8_t ver_b, IN uint8_t *aes_key_ver_c, + uint8_t ver_c, OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param master_aes_key ADD DESCRIPTION + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_pre_personalization_switch_to_AV2_modeM(UFR_HANDLE hndUFR, IN uint8_t *master_aes_key, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function is used to run a mutual 3-pass authentication between the MIFARE SAM AV2 and PC. A host authentication is required to: + * • Load or update keys into the MIFARE SAM AV2 + * • Activate the MIFARE SAM AV2 after reset (if configured accordingly in the configuration settings of master key key_no 00h) + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param host_aes_key pointer to array containing 16 bytes AES key + * @param key_nr key reference number (0 - 127) + * @param key_version key version (0 - 255) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_authenticate_host_AV2_plainM(UFR_HANDLE hndUFR, IN uint8_t *host_aes_key, uint8_t key_nr, uint8_t key_version, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing two Crypto 1 keys (KeyA and KeyB) for authentication to Mifare Classic or Mifare Plus card in SL1 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param keyA pointer to array containing 6 bytes Crypto 1 key A + * @param keyB pointer to array containing 6 bytes Crypto 1 key B + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_mifare_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *keyA, + IN uint8_t *keyB, uint8_t key_no_CEK, uint8_t key_v_CEK, + uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing AES key for authentication to Mifare Desfire or Mifare Plus card in SL3 mode. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 16 bytes of AES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_AES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST containing 3K3DES key for authentication to Mifare Desfire card. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (1 - 127) + * @param key pointer to array containing 24 bytes of 3K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_3K3DES_AV2_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_ULC_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param key pointer to array containing 24 bytes of 2K3DES key + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_2K3DES_AV2_desfire_plain_one_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *key, + uint8_t key_no_CEK, uint8_t key_v_CEK, uint8_t ref_no_KUC, + OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. Function allows changing KST (Key Storage Table) containing 3 AES-128 keys, and their versions. + * The communication in this process is plain, so keys will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_entry_no key reference number (0 - 127) + * @param aes_key_ver_a pointer to array containing 16 bytes of first AES key + * @param ver_a key version of first key (0 - 255) + * @param aes_key_ver_b pointer to array containing 16 bytes of second AES key + * @param ver_b key version of second key (0 - 255) + * @param aes_key_ver_c pointer to array containing 16 bytes of third AES key + * @param ver_c key version of third key (0 - 255) + * @param key_no_CEK reference number of CEK (Change Entry Key). (future host authentication for change this KST must be with AES key with key_no_CEK key reference number) + * @param key_v_CEK version of CEK (future host authentication for change this KST must be with AES key with key_ver_CEK key version) + * @param ref_no_KUC reference number of KUC (Key Usage Counter) (not support jet, unlimited number of authentication ref_no_KUC = 0xFF) + * @param sam_lock_unlock SAM lock/unlock ability. If key_entry_no = 0 (master key), then the SAM will be locked after power up or reset, and minimal set of commands will be available. + * @param sam_auth_host Host authentication ability. If key_entry_no = 0 (master key), then the authentication with host key is mandatory after power up or reset, in opposition minimal set of commands will be available. + * @param apdu_sw pointer to array containing SW1 and SW2 APDU status bytes + * + * @return Operation status + */ + UFR_STATUS DL_API SAM_change_key_entry_aes_AV2_plain_host_keyM(UFR_HANDLE hndUFR, uint8_t key_entry_no, IN uint8_t *aes_key_ver_a, + uint8_t ver_a, IN uint8_t *aes_key_ver_b, uint8_t ver_b, + IN uint8_t *aes_key_ver_c, uint8_t ver_c, uint8_t key_no_CEK, + uint8_t key_v_CEK, uint8_t ref_no_KUC, uint8_t sam_lock_unlock, + uint8_t sam_auth_host, OUT uint8_t *apdu_sw); + + /** + * @brief Multi reader support. If master key has enabled lock/unlock parameter, then SAM unlock with key with lock/unlock ability is required. uFR reader tries to unlock SAM with key which stored into reader by this function. If internal reader keys locked, then they must be unlocked first, with function ReaderKeysUnlock. + * The communication in this process is plain, so key will be exposed during function execution. Use this function in security environment (disconnect LAN). + * + * @ingroup ReaderAndLibrary_NXPSAM_M + * + * @param hndUFR handle of the uFR device + * @param key_no key reference number (0 - 127) + * @param key_ver key version (0 - 255) + * @param aes_key pointer to array containing 16 bytes of AES key + * + * @return Operation status + */ + UFR_STATUS DL_API WriteSamUnlockKeyM(UFR_HANDLE hndUFR, uint8_t key_no, uint8_t key_ver, IN uint8_t *aes_key); + + /** + * @brief Function tries to change the UID on the card. + * Multi reader support. + * On some cards (e.g. Magic Classic) changing UID is possible. If theed card is that type of card, then the function returns UFR_OK. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API CheckUidChangeableM(UFR_HANDLE hndUFR); + + /** + * @brief Function reset RF field at the reader. The RF field will be off, and then on after 50ms. + * + * Multi reader support. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfResetM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch on RF field at the reader. + * + * For proper functionality the reader must be in the multi card mode. + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOnM(UFR_HANDLE hndUFR); + + /** + * @brief Function switch off RF field at the reader. + * + * Multi reader support. + * From library version 5.0.48, and firmware version 5.0.51. + * For proper functionality the reader must be in the multi card mode. The RF field can be switched on by functions ReaderRfOn, EnumCards, or DisableAnticolision. + * + * @ingroup Miscellaneous_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API ReaderRfOffM(UFR_HANDLE hndUFR); + + /** + * EXCLUDE FROM DOCUMENTATION + * @ingroup INTERNAL + */ + UFR_STATUS DL_API WriteReaderIdM(UFR_HANDLE hndUFR, uint8_t *reader_id); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to change the data and AES keys from the initial delivery configuration to a customer specific value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param address Number of block or key + * @param data Value of data or AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_WritePersoM(UFR_HANDLE hndUFR, uint16_t address, IN uint8_t *data); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used to finalize the personalization and switch up to security level 1. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_CommitPersoM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. Security level 0 command. + * Function is used for card personalization. The minimum number of AES keys is entered into the card. There are card master key, card configuration key, key for switch to security level 2, key for switch to security level 3, security level 1 authentication key, virtual card select key, proximity check key, VC polling ENC and VC poling MAC key. Keys can not be changed at security level 1. + * Other keys that are not personalized will have value 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF) + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param card_master_key pointer to 16 byte array containing the card master key + * @param card_config_key pointer to 16 byte array containing the card configuration key + * @param level_2_switch_key pointer to 16 byte array containing the key for switch to security level 2 + * @param level_3_switch_key pointer to 16 byte array containing the key for switch to security level 3 + * @param level_1_auth_key pointer to 16 byte array containing the key for optional authentication at security level 1 + * @param select_vc_key pointer to 16 byte array containing the key for virtual card selection + * @param prox_chk_key pointer to 16 byte array containing the key for proximity check + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling + * @param vc_poll_mac_key pointer to 16 byte array containing the MAC key for virtual card polling + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_PersonalizationMinimalM(UFR_HANDLE hndUFR, IN uint8_t *card_master_key, IN uint8_t *card_config_key, + IN uint8_t *level_2_switch_key, IN uint8_t *level_3_switch_key, IN uint8_t *level_1_auth_key, + IN uint8_t *select_vc_key, IN uint8_t *prox_chk_key, IN uint8_t *vc_poll_enc_key, + IN uint8_t *vc_poll_mac_key); + + /** + * @brief Multi reader support. Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 or 2 command. + * Function is used to switch to security level 3. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_SwitchToSecurityLevel3_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of AES key stored into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1M(UFR_HANDLE hndUFR, uint8_t key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 1 command. + * Security level 1 offers the same functionality as a MIFARE Classic card. + * Function is used to optional AES authentication. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param aes_key pointer to 16 byte array containing the AES key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_AesAuthSecurityLevel1_PKM(UFR_HANDLE hndUFR, IN uint8_t *aes_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card master key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current master key + * @param new_key pointer to 16 byte array containing the new master key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeMasterKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeyM(UFR_HANDLE hndUFR, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index ordinary number of current configuration key stored into reader (0 - 15) or in SAM (1 - 127) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKeySamKeyM(UFR_HANDLE hndUFR, uint8_t key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES card configuration key value. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param old_key pointer to 16 byte array containing the current configuration key + * @param new_key pointer to 16 byte array containing the new configuration key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeConfigurationKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of configuration key stored into reader (0 - 15) + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSetSamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t rid_use, + uint8_t prox_check_use); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used for definition of using Random ID and Proximity check options. Authentication with AES card configuration key required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing the configuration key + * @param rid_use 1 - Randnom ID enabled, 0 - Random ID disabled + * @param prox_check_use 1- Proximity check is mandatory, 0 - Proximity check is not mandatory + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_FieldConfigurationSet_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, uint8_t rid_use, uint8_t prox_check_use); + + /** + * @brief Multi reader support. Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ordinary number of current configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * In order to access the block in sector data, AES authentication is needed. Each sector has two AES keys that can be used for authentication (Key A and Key B). + * Default value if key is not personalized is 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF (16 x 0xFF). + * For linear read part of card, enter the same value of sector keys for all sectors which will be read at once. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card. + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKey_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param key_index ordinary number of current sector key stored into reader (0 - 15) + * @param new_key_index ADordinary number of current sector key stored into reader that wile become new key + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeySamExtKeyM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, uint8_t key_index, + uint8_t new_key_index, uint8_t new_key_type); + + /** + * + * @ingroup Card_Tag_Mifare_Plus_M + * @ingroup UNDOCUMENTED + * + * @param hndUFR handle of the uFR device + * @param sector_nr ordinary number of sector (0 - 31) for 2K card, or (0 - 39) for 4K card + * @param auth_mode MIFARE_AUTHENT1A for Key A or MIFARE_AUTHENT1B for Kye B + * @param old_key pointer to 16 byte array containing the current sector key (A or B) + * @param new_key pointer to 16 byte array containing the new sector key (A or B) + * @param new_key_type AES_KEY_TYPE = 0, //AES 16 bytes DES3K_KEY_TYPE = 1, //3K3DES 24 bytes DES_KEY_TYPE = 2, //DES 8 bytes DES2K_KEY_TYPE = 3 //2K3DES 16 bytes + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeSectorKeyExt_PKM(UFR_HANDLE hndUFR, uint8_t sector_nr, uint8_t auth_mode, IN uint8_t *old_key, IN uint8_t *new_key, + uint8_t new_key_type); + + /** + * @brief Multi reader support. Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param key_index_vc_poll_enc_key pointer to 16 byte array containing VC polling ENC key + * @param key_index_vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUidSamKeyM(UFR_HANDLE hndUFR, uint8_t key_index_vc_poll_enc_key, uint8_t key_index_vc_poll_mac_key, + OUT uint8_t *uid, VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * Function is used to read UID if Random ID is enabled. Authentication with AES VC Polling ENC Key and VC Polling MAC Key is mandatory. + * + * @param hndUFR handle of the uFR device + * @param vc_poll_enc_key pointer to 16 byte array containing the ENC key for virtual card polling pointer to 16 byte array containing VC polling ENC key + * @param vc_poll_mac_key pointer to 16 byte array containing VC polling MAC key + * @param uid pointer to byte array containing the card UID + * @param uid_len pointer to UID length variable + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_GetUid_PKM(UFR_HANDLE hndUFR, IN uint8_t *vc_poll_enc_key, IN uint8_t *vc_poll_mac_key, OUT uint8_t *uid, + VAR uint8_t *uid_len); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling ENC key value. Authentication with AES card configuration key is required. + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling ENC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingEncKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + /** + * @brief Multi reader support. Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, IN uint8_t *new_key); + + /** + * @brief Multi reader support. *only uFR CS with SAM support + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key_index ordinary number of card configuration key stored into reader (0 - 15) + * @param new_key_index ordinary number of card configuration key stored into reader that will become new key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKeySamKeyM(UFR_HANDLE hndUFR, uint8_t configuration_key_index, uint8_t new_key_index); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Security level 3 command. + * The function is used to change the AES VC polling MAC key value. Authentication with AES card configuration key is required. + * + * @ingroup Card_Tag_Mifare_Plus_M + * + * @param hndUFR handle of the uFR device + * @param configuration_key pointer to 16 byte array containing card configuration key + * @param new_key pointer to 16 byte array containing new VC Polling MAC key + * + * @return Operation status + */ + UFR_STATUS DL_API MFP_ChangeVcPollingMacKey_PKM(UFR_HANDLE hndUFR, IN uint8_t *configuration_key, IN uint8_t *new_key); + + // ULTRALIGHT C + /** + * @brief Multi reader support. Provided Key mode (PK) + * The 3DES authentication is executed using the transceive mode of reader. Pointer to array which contains 2K 3DES key (16 bytes ) is parameter of this functions. Function don’t use the key which stored into reader. DES algorithm for authentication executes in host device, not in reader. + * After authentication, the reader leaves the transceive mode, but stay in mode where the HALT command doesn’t sending to the card. In this mode user can use functions for block and linear reading or writing. Reader stay into this mode, until the error during reading data from card, or writing data into card occurs, or until the user calls function card_halt_enable(). + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param key pointer to data array of 16 bytes which contains 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_ExternalAuth_PKM(UFR_HANDLE hndUFR, IN uint8_t *key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_authM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_keyM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + /** + * @brief Multi reader support. No authentication + * This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_no_auth_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_factory_key_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key); + + /** + * @brief Multi reader support. This function puts the reader in an “anti-collision” mode of operation. + * + * @ingroup Card_Tag_Ultralight_C_M + * + * @param hndUFR handle of the uFR device + * @param new_3des_key pointer to array of 16 bytes which contains new 2K 3DES key + * @param old_3des_key pointer to array of 16 bytes which contains current 2K 3DES key + * + * @return Operation status + */ + UFR_STATUS DL_API ULC_write_3des_key_internalM(UFR_HANDLE hndUFR, IN uint8_t *new_3des_key, IN uint8_t *old_3des_key); + + + // ESP32 + /** + * @brief Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. + * + * Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayData(IN uint8_t *display_data, IN uint8_t data_length, uint16_t duration); + + /** + * @brief Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderReset(void); + + /** + * @brief It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPassword(IN uint8_t *old_password, IN uint8_t *new_password); + + /** + * @brief Function writes array of data into EEPROM of uFR Online. + * + * Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWrite(IN uint8_t *data, uint32_t address, uint32_t size, IN uint8_t *password); + + /** + * @brief Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromRead(OUT uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param time pointer to the array containing current date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTime(OUT uint8_t *time); + + /** + * @brief Function sets the date and time into uFR Online RTC. + * + * Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTime(IN uint8_t *password, IN uint8_t *time); + + /** + * @brief Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOState(uint8_t pin, uint8_t state); + + /** + * @brief Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOState(OUT uint8_t *state); + + /** + * @brief Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReader(uint8_t reader); + + /** + * @brief Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param SerialNumber pointer to SerialNumber variable. “SerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumber(VAR uint32_t *SerialNumber); + + /** + * @brief Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersion(OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOff(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifi(void); + + /** + * @brief This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableWifi(void); + + // NDEF MESSAGES + //---------------------------------------------------------- + + enum NDEF_STORAGE_MODE + { + STORE_INTO_READER = 0, + STORE_INTO_CARD + }; + + enum NDEF_SKYPE_ACTION + { + CALL = 0, + CHAT + }; + + // WiFi NDEF authentication type + enum WIFI_AUTH_TYPE + { + OPEN = 0, + WPA_PERSONAL, + WPA_ENTERPRISE, + WPA2_ENTERPRISE, + WPA2_PERSONAL + }; + + // WiFi NDEF encryption type + enum WIFI_ENC_TYPE + { + NONE = 0, + WEP, + TKIP, + AES, + AES_TKIP + }; + + /** + * @brief + * Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFi(uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, uint8_t encryption_type, + IN const char *password); + + /** + * @brief Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters)(e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BT(uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMS(uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Bitcoin(uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocation(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestination(uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Email(uint8_t ndef_storage, IN const char *email_address, IN const char *subject, IN const char *message); + + /** + * @brief Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Address(uint8_t ndef_storage, IN const char *address); + + /** + * @brief Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidApp(uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Store text as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Text(uint8_t ndef_storage, IN const char *text); + + /** + * @brief Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetView(uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Skype(uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Whatsapp(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Viber(uint8_t ndef_storage, IN const char *message); + + /** + * @brief Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Contact(uint8_t ndef_storage, IN const char *name, IN const char *company, IN const char *address, + IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF + * + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_Phone(uint8_t ndef_storage, IN const char *phone_number); + + /** + * @brief Multi reader support. Store WiFi configuration as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param ssid Pointer to the null-terminated string that should contain SSID name we want to connect to + * @param auth_type Authentication type: 0 - OPEN 1 - WPA Personal 2 - WPA Enterprise 3 - WPA2 Enterprise 4 - WPA2 Personal + * @param encryption_type Encryption type: 0 - NONE 1 - WEP 2 - TKIP 3 - AES 4 - AES/TKIP + * @param password Pointer to the null-terminated string that should contain password of the SSID we want to connect to + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WiFiM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *ssid, uint8_t auth_type, + uint8_t encryption_type, IN const char *password); + + /** + * @brief Multi reader support. Store BT MAC address for pairing as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bt_mac_address Pointer to the null-terminated string that should contain BT MAC address for pairing in hex format (12 characters) (e.g.: “AABBCCDDEEFF”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BTM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bt_mac_address); + + /** + * @brief Multi reader support. Store phone number and message data as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to the null-terminated string that should contain message data + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SMSM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number, IN const char *message); + + /** + * @brief Multi reader support. Store bitcoin address, amount and donation message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param bitcoin_address Pointer to the null-terminated string that should contain bitcoin address + * @param amount Pointer to the null-terminated string that should contain amount (e.g.: “1.0”) + * @param message Pointer to the null-terminated string that should contain donation message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_BitcoinM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *bitcoin_address, IN const char *amount, + IN const char *message); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store wanted destination as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param destination Pointer to the null-terminated string that should contain city, street name or some other destination + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *destination); + + /** + * @brief Multi reader support. Store email message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param email_address Pointer to the null-terminated string that should contain recipient email address + * @param subject Pointer to the null-terminated string that should contain subject + * @param message Pointer to the null-terminated string that should contain message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_EmailM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *email_address, IN const char *subject, + IN const char *message); + + /** + * @brief Multi reader support. Store address (city, street name, etc) as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param address Pointer to the null-terminated string that should contain city name, street name, etc. + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AddressM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *address); + + /** + * @brief Multi reader support. Store android app package name as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param package_name Pointer to the null-terminated string that should contain android app packagne name + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *package_name); + + /** + * @brief Multi reader support. Store text as NDEF message into reader or into card. + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param text Pointer to the null-terminated string that should contain text + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_TextM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *text); + + /** + * @brief Multi reader support. Store latitude and longitude as NDEF message into reader or into card for Google StreetView. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param latitude Pointer to the null-terminated string that should contain latitude (e.g.: “44.6229337”) + * @param longitude Pointer to the null-terminated string that should contain longitude (e.g.: “21.1787368”) + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_StreetViewM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *latitude, IN const char *longitude); + + /** + * @brief Multi reader support. Store skype username as NDEF message into reader or into card for call or chat. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Action type: call - 0 chat - 1 + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_SkypeM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *user_name, uint8_t action); + + /** + * @brief Multi reader support. Store Whatsapp message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_WhatsappM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store Viber message as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param message Pointer to the null-terminated string that should contain Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ViberM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *message); + + /** + * @brief Multi reader support. Store phone contact as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param name pointer to the null-terminated string that should contain contact display name + * @param company pointer to the null-terminated string that should contain contact company name + * @param address Pointer to the null-terminated string that should contain contact residental address + * @param phone pointer to the null-terminated string that should contain contact phone number + * @param email pointer to the null-terminated string that should contain contact email address + * @param website pointer to the null-terminated string that should contain contact website + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_ContactM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *name, IN const char *company, + IN const char *address, IN const char *phone, IN const char *email, IN const char *website); + + /** + * @brief Multi reader support. Store phone_number as NDEF message into reader or into card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ndef_storage Store NDEF into: reader - 0, card - 1 From library 5.0.31 and firmware 5.0.33 2 - reader RAM + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API WriteNdefRecord_PhoneM(UFR_HANDLE hndUFR, uint8_t ndef_storage, IN const char *phone_number); + //--------------------------------------------------------------------------------------------- + /** + * @brief Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF + * + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFi(OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, OUT char *password); + + /** + * @brief Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Bitcoin(OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocation(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF + * + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestination(OUT char *destination); + + /** + * @brief Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Email(OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF + * + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Address(OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF + * + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidApp(OUT char *package_name); + + /** + * @brief Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF + * + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Text(OUT char *text); + + /** + * @brief Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF + * + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetView(OUT char *latitude, OUT char *longitude); + + /** + * @brief Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF + * + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Skype(OUT char *user_name, OUT char *action); + + /** + * @brief Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Whatsapp(OUT char *message); + + /** + * @brief Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Viber(OUT char *message); + + /** + * @brief Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF + * + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Contact(OUT char *vCard); + + /** + * @brief Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_Phone(OUT char *phone_number); + + /** + * @brief Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF + * + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMS(OUT char *phone_number, OUT char *message); + + /** + * @brief Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF + * + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BT(OUT char *bt_mac_address); + + /** + * @brief Multi reader support. Reads NDEF WiFi configuration from card.. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param ssid Pointer to char array containing SSID name + * @param auth_type Pointer to char array containing authentication type + * @param encryption_type Pointer to char array containing encryption type + * @param password Pointer to char array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WiFiM(UFR_HANDLE hndUFR, OUT char *ssid, OUT char *auth_type, OUT char *encryption_type, + OUT char *password); + + /** + * @brief Multi reader support. Reads NDEF bitcoin address, amount and donation message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bitcoin_address Pointer to char array containing bitcoin_address + * @param amount Pointer to char array containing bitcoin amount + * @param message Pointer to char array containing donation message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BitcoinM(UFR_HANDLE hndUFR, OUT char *bitcoin_address, OUT char *amount, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_GeoLocationM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF navigation destination from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param destination Pointer to char array containing destination + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_NaviDestinationM(UFR_HANDLE hndUFR, OUT char *destination); + + /** + * @brief Multi reader support. Reads NDEF email address, subject and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param email_address Pointer to char array containing recipient email address + * @param subject Pointer to char array containing subject + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_EmailM(UFR_HANDLE hndUFR, OUT char *email_address, OUT char *subject, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF address (city, street name,etc) from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param address Pointer to char array containing address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AddressM(UFR_HANDLE hndUFR, OUT char *address); + + /** + * @brief Reads android app package name stored as NDEF record + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param package_name Pointer to the null-terminated string that should contain android app package name + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_AndroidAppM(UFR_HANDLE hndUFR, OUT char *package_name); + + /** + * @brief Multi reader support. Reads NDEF text from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param text Pointer to char array containing text + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_TextM(UFR_HANDLE hndUFR, OUT char *text); + + /** + * @brief Multi reader support. Reads NDEF latitude and longitude for Google StreetView from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param latitude Pointer to char array containing latitude + * @param longitude Pointer to char array containing longitude + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_StreetViewM(UFR_HANDLE hndUFR, OUT char *latitude, OUT char *longitude); + + /** + * @brief Multi reader support. Reads NDEF skype username and action from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param user_name pointer to the null-terminated string that should contain skype username + * @param action Pointer to char array containing Skype action (“call” or “chat”) + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SkypeM(UFR_HANDLE hndUFR, OUT char *user_name, OUT char *action); + + /** + * @brief Multi reader support. Reads NDEF Whatsapp message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Whatsapp message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_WhatsappM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Viber message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param message Pointer to char array containing Viber message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ViberM(UFR_HANDLE hndUFR, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF phone contact from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param vCard Pointer to char array containing phone contact data + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_ContactM(UFR_HANDLE hndUFR, OUT char *vCard); + + /** + * @brief Multi reader support. Reads NDEF phone number from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_PhoneM(UFR_HANDLE hndUFR, OUT char *phone_number); + + /** + * @brief Multi reader support. Reads NDEF phone number and message from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param phone_number Pointer to char array containing phone number + * @param message Pointer to char array containing message + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_SMSM(UFR_HANDLE hndUFR, OUT char *phone_number, OUT char *message); + + /** + * @brief Multi reader support. Reads NDEF Bluetooth MAC address for pairing from card. + * + * @ingroup Card_Tag_NDEF_M + * + * @param hndUFR handle of the uFR device + * @param bt_mac_address Pointer to char array containing Bluetooth MAC address + * + * @return Operation status + */ + UFR_STATUS DL_API ReadNdefRecord_BTM(UFR_HANDLE hndUFR, OUT char *bt_mac_address); + + /** + * @brief Used to parse NDEF record into separate parameters + * + * @ingroup Card_Tag_NDEF + * + * @param type_record pointer to the array containing record type + * @param type_len length of the record type + * @param payload pointer to the array containing record payload + * @param payload_len length of the record payload + * + * @return Operation status + */ + c_string DL_API ParseNdefMessage(IN uint8_t *type_record, uint8_t type_len, IN uint8_t *payload, uint32_t payload_len); + + // NT4H + + /** + * @brief Multi reader support. Function sets file number, key number, and communication mode, before the using functions for reading and writing data into cards which are used for NTAG 2xx cards. This makes it possible to use existing functions for the block and linear reading and writing. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param communication_mode 0 - plain, 1 - MACed, 3 - enciphered + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_global_parametersM(UFR_HANDLE hndUFR, uint8_t file_no, uint8_t key_no, uint8_t communication_mode); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. The function changes the access parameters of an existing standard data file. The communication mode can be either plain or enciphered based on current access rights of the file, so current communication mode must be entered. Access rights are similar for Desfire cards. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 and NTAG 424 TT - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 and NTAG 424 TT - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_standard_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no NTAG 413 - 1 or 2 NTAG 424 - 1 to 3 + * @param key_no current change key number NTAG 413 - 0 to 2 NTAG 424 - 0 to 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG 424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC read_crt_limit value of SDM reading counter limit + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit); + + /** + * @brief Multi reader support. Function returns file settings. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2, NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_rid_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext); + + /** + * @brief Multi reader support. Function enables card Random ID. Authentication with application master key (key number 0) required. + * Warning. This operation is ireversibile. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_set_ridM(UFR_HANDLE hndUFR, uint8_t aes_key_no); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uid_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Function returns card UID if Random ID activated. Valid authentication is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no card key no used for authentication + * @param uid pointer to array contained UID + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_uidM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, OUT uint8_t *uid); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_key_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Function changes AES key. Authentication with the application master key is required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param key_no key number 0 - 2 or 0 - 4 + * @param new_key pointer to array contained new AES key + * @param old_key pointer to array contained current AES key + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_change_keyM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t key_no, IN uint8_t *new_key, IN uint8_t *old_key); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no file number of SDM file (2) + * @param key_no key number 0 - 2 or 0 - 4 + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctrM(UFR_HANDLE hndUFR, uint8_t auth_key_no, uint8_t file_no, uint8_t key_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. No authentication + * Function supports retrieving of the current values of SDM reading counter. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no file number of SDM file (2) + * @param sdm_read_ctr pointer to value of SDM reading counter + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_sdm_ctr_no_authM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint32_t *sdm_read_ctr); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function allows change parameters for secure dynamic messaging file, or change file type from standard data file to secure dynamic messaging file. Due to the large number of parameters, the function is separated from the function for creating a standard data file. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param file_no 1 - 3 + * @param key_no current change key number 0 - 4 + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain + * @param read_key_no reading key number (14 free access) + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4, 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data + * @param enc_length length of encrypted part of file data + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status mirroring (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_change_sdm_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no, + uint8_t uid_enable, uint8_t read_ctr_enable, uint8_t read_ctr_limit_enable, uint8_t enc_file_data_enable, + uint8_t meta_data_key_no, uint8_t file_data_read_key_no, uint8_t read_ctr_key_no, + uint32_t uid_offset, uint32_t read_ctr_offset, uint32_t picc_data_offset, uint32_t mac_input_offset, + uint32_t enc_offset, uint32_t enc_length, uint32_t mac_offset, uint32_t read_ctr_limit, + uint8_t tt_status_enable, uint32_t tt_status_offset); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param file_no NTAG 413 - 1 or 2; NTAG 424 - 1 to 3 + * @param file_type 0 - standard data file + * @param communication_mode communication mode, 0 - plain, 1 - MACed, 3 - enciphered + * @param sdm_enable 0 - SDM disabled, 1 - SDM enabled + * @param file_size file size in bytes + * @param read_key_no reading key number + * @param write_key_no writing key number + * @param read_write_key_no reading and writing key number + * @param change_key_no new change key number + * @param uid_enable UID mirroring (0 - disabled, 1 - enabled) + * @param read_ctr_enable SDM reading counter (0 - disabled, 1 - enabled) + * @param read_ctr_limit_enable SDM reading counter limit (0 - disabled, 1 - enabled) + * @param enc_file_data_enable using encrypted part of file data (NTAG 424 only) (0 - disabled, 1 - enabled) + * @param meta_data_key_no key number for PICC data (UID and SDM read ctr) encryption 0 - 4 (NTAG 424 only), 14 no encryption, 15 no PICC data + * @param file_data_read_key_no key number for MAC and encrypted part of file data (NTAG424 only) 0 - 2 or 0 - 4, 15 no MAC + * @param read_ctr_key_no key number for SDM reading counter retrieving 0 - 2 or 0 - 4, 14 free, 15 no access + * @param uid_offset mirror position of UID if PICC data aren’t encrypted + * @param read_ctr_offset mirror position of SDM reading counter if PICC data aren’t encrypted + * @param picc_data_offset mirror position of encrypted PICC data (NTAG 424 only) + * @param mac_input_offset offset in the file where the SDM MAC computation starts + * @param enc_offset mirror position of encrypted part of file data (NTAG 424 only) + * @param enc_length length of encrypted part of file data (NTAG 424 only) + * @param mac_offset mirror position of SDM MAC + * @param read_ctr_limit value of SDM reading counter limit + * @param tt_status_enable tag tamper status (0 - disabled, 1 - enabled) + * @param tt_status_offset mirror position of tag tamper status + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_tt_get_file_settingsM(UFR_HANDLE hndUFR, uint8_t file_no, VAR uint8_t *file_type, VAR uint8_t *communication_mode, VAR uint8_t *sdm_enable, VAR uint32_t *file_size, + VAR uint8_t *read_key_no, VAR uint8_t *write_key_no, VAR uint8_t *read_write_key_no, VAR uint8_t *change_key_no, + VAR uint8_t *uid_enable, VAR uint8_t *read_ctr_enable, VAR uint8_t *read_ctr_limit_enable, VAR uint8_t *enc_file_data_enable, + VAR uint8_t *meta_data_key_no, VAR uint8_t *file_data_read_key_no, VAR uint8_t *read_ctr_key_no, + VAR uint32_t *uid_offset, VAR uint32_t *read_ctr_offset, VAR uint32_t *picc_data_offset, VAR uint32_t *mac_input_offset, + VAR uint32_t *enc_offset, VAR uint32_t *enc_length, VAR uint32_t *mac_offset, VAR uint32_t *read_ctr_limit, + VAR uint8_t *tt_status_enable, VAR uint32_t *tt_status_offset); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key pointer to array contained AES key auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signature_pkM(UFR_HANDLE hndUFR, IN uint8_t *auth_key, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, VAR uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. From library version 5.0.43 and firmware version 5.0.43. + * Function retrieves the asymmetric originality signature based on an asymmetric cryptographic algorithm Elliptic Curve Cryptography Digital Signature Algorithm (ECDSA) when the Random ID is activated. Authentication with valid key required. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param auth_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 + * @param uid 7 bytes UID length + * @param ecc_signature 56 bytes ECC signature + * @param dlogic_card_type card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_rid_read_ecc_signatureM(UFR_HANDLE hndUFR, uint8_t auth_key_nr, uint8_t key_no, OUT uint8_t *uid, + OUT uint8_t *ecc_signature, OUT uint8_t *dlogic_card_type); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_nr ordinal number of AES key into reader (0 - 15) + * @param key_no 0 - 4 *uid 7 bytes UID length *ecc_signature 56 bytes ECC signature *dlogic_card_type + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_statusM(UFR_HANDLE hndUFR, uint8_t aes_key_nr, uint8_t key_no, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. No authentication + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function supports retrieving of the permanent and current Tag Tamper Status. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param tt_perm_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * @param tt_curr_status tag tamper permanent status: I - invalid status, feature not activated; C - tamper seal closed; O - tamper seal opened + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_get_tt_status_no_authM(UFR_HANDLE hndUFR, VAR uint8_t *tt_perm_status, VAR uint8_t *tt_curr_status); + + /** + * @brief Multi reader support. Provided Key mode (PK) + * NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_tt_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. NTAG 424 TT only. From library version 5.0.43 and firmware version 5.0.43. + * Function enabling tag tamper feature. Authentication with application master key (key number 0) required. + * Warning. Enabling the Tag Tamper feature is permanent, it cannot be disabled once enabled. + * + * @ingroup Card_Tag_NT4H_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no ordinal number of AES key into reader (0 - 15) + * @param tt_status_key_no 0 - 4, 14 free access + * + * @return Operation status + */ + UFR_STATUS DL_API nt4h_enable_ttM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t tt_status_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settings_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function changes file settings. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 0, 1, 3, 4, 15 or 31 + * @param key_no current change key no + * @param curr_communication_mode current communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param new_communication_mode new communication mode 0 - plain, 1 - MACed, 3 - enciphered + * @param read_key_no read key number (0 - 4) + * @param write_key_no write key number (0 - 4) + * @param read_write_key_no read write key number (0 - 4) + * @param change_key_no change key number (0 - 4) + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_change_file_settingsM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no, uint8_t key_no, uint8_t curr_communication_mode, + uint8_t new_communication_mode, uint8_t read_key_no, uint8_t write_key_no, uint8_t read_write_key_no, uint8_t change_key_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_ext pointer to array contained AES key aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_file_pkM(UFR_HANDLE hndUFR, IN uint8_t *aes_key_ext, uint8_t file_no); + + /** + * @brief Multi reader support. From library version 5.0.29 and firmware version 5.0.32. Desfire Light specific command. + * Function delete transaction MAC file. + * NOTE: Transaction MAC file exist by factory default. To use the operations with value file, and cyclic record file, this file must be deleted. + * From library version 5.0.37 and firmware version 5.0.38, Transaction MAC operation supported for Desfire Light and Desfire EV2. To use these features, an Transaction MAC file must exist in the selected application. + * + * @ingroup Card_Tag_Mifare_Desfire_Light_M + * + * @param hndUFR handle of the uFR device + * @param aes_key_no reader key number of AES key (0 - 15) + * @param file_no file number 15 + * + * @return Operation status + */ + UFR_STATUS DL_API dfl_delete_tmc_fileM(UFR_HANDLE hndUFR, uint8_t aes_key_no, uint8_t file_no); + + /** + * @brief Multi reader support. Function enables sending data to the uFR Online. A string of data contains information about the intensity of color in each cell of the LED indication. Each cell has three LEDs (red, green and blue). For each cell of the three bytes is necessary. The first byte indicates the intensity of the green color, the second byte indicates the intensity of the red color, and the third byte indicates the intensity of blue color. For example, if the display has 2 cells, an array contains 6 bytes. Value of intensity is in the range from 0 to 255. On uFR Online, there are 2 cells.From firmware version 2.7.6, RGB LEDs can be connected to pin 5 of P5 connector (GPIO connector - ESP pin 18). First 6 bytes in display_data array will be sent to internal RGB LEDs, additional bytes will be sent to external connected RGB. There is no limit for number of external cells. + * Array data example: 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + * First 6 bytes will be sent to internal RGB and additional 3 bytes will be sent to first cell of external RGB. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param display_data pointer to data array + * @param data_length number of bytes into array + * @param duration number of milliseconds to light. if value is 0, then rgb will light infinitely + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetDisplayDataM(UFR_HANDLE hndUFR, uint8_t *display_data, uint8_t data_length, uint16_t duration); + + /** + * @brief Multi reader support. Physical reset of uFR reader communication port. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderResetM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. It defines/changes password which I used for: + * * Writing in EEPROM + * * Setting date/time of RTC + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param old_password pointer to the 8 bytes array containing current password + * @param new_password pointer to the 8 bytes array containing new password + * + * @return Operation status + */ + UFR_STATUS DL_API EspChangeReaderPasswordM(UFR_HANDLE hndUFR, uint8_t *old_password, uint8_t *new_password); + + /** + * @brief Multi reader support. Function writes array of data into EEPROM of uFR Online. Maximal length of the array is 128 bytes. Function requires a password which is 8 bytes. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * @param password pointer to array containing password + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromWriteM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size, uint8_t *password); + + /** + * @brief Multi reader support. Function returns array of data read from EEPROM of uFR Online. Maximal length of the array is 128 bytes. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param data pointer to array containing data from EEPROM + * @param address address of first data + * @param size length of array + * + * @return Operation status + */ + UFR_STATUS DL_API EspReaderEepromReadM(UFR_HANDLE hndUFR, uint8_t *data, uint32_t address, uint32_t size); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represents current date and time into uFR Online RTC. + * * Byte 0 represent year (current year - 2000) + * * Byte 1 represent month (1 - 12) + * * Byte 2 represent day of the month (1 - 31) + * * Byte 3 represent hour (0 - 23) + * * Byte 4 represent minute (0 - 59) + * * Byte 5 represent second (0 - 59) + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *time); + + /** + * @brief Multi reader support. Function sets the date and time into uFR Online RTC. Function requires the 8 bytes password entry to set date and time. Date and time are represented into a 6 bytes array in the same way as in EspGetReaderTime function. Factory password is “11111111” (0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31). + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param password pointer to the 8 bytes array containing password + * @param time pointer to the 6 bytes array containing date and time representation + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetReaderTimeM(UFR_HANDLE hndUFR, uint8_t *password, uint8_t *time); + + /** + * @brief Multi reader support. Function sets uFR Online IO pin state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param pin IO pin number (1 - 6) + * @param state IO pin state 0 - low level, 1 - high level, 2 - input + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetIOStateM(UFR_HANDLE hndUFR, uint8_t pin, uint8_t state); + + /** + * @brief Multi reader support. Function returns 6 bytes array of uint8_t that represented IO pins logic level state. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param state pointer to the 6 bytes array containing IO pins states + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetIOStateM(UFR_HANDLE hndUFR, uint8_t *state); + + /** + * @brief Multi reader support. Function sets uFR Online transparent reader. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param reader Transparent reader number + * + * @return Operation status + */ + UFR_STATUS DL_API EspSetTransparentReaderM(UFR_HANDLE hndUFR, uint8_t reader); + + /** + * @brief Multi reader support. Returns uFR Online reader serial number as a pointer to 4 byte value. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands_M + * + * @param hndUFR handle of the uFR device + * @param lpulSerialNumber pointer to lpulSerialNumber variable. “lpulSerialNumber “ as result holds 4 byte serial number value. + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetReaderSerialNumberM(UFR_HANDLE hndUFR, uint32_t *lpulSerialNumber); + + /** + * @brief Multi reader support. Returns uFR Online reader firmware version. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * @param major Major firmware version + * @param minor Minor firmware version + * @param build Build firmware version + * + * @return Operation status + */ + UFR_STATUS DL_API EspGetFirmwareVersionM(UFR_HANDLE hndUFR, OUT uint8_t *major, OUT uint8_t *minor, OUT uint8_t *build); + + /** + * @brief Multi reader support. Turn off uFR Online device. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspTurnOffM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Disable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned off device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspDisableWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Multi reader support. This option is only avaliable in BT/BLE mode. Enable Wifi on uFR Online device when working in BLE/BT mode. This option is saved in flash and Wifi will stay turned on device restart. + * + * @ingroup ReaderAndLibrary_uFROnlineCommands + * + * @param hndUFR handle of the uFR device + * + * @return Operation status + */ + UFR_STATUS DL_API EspEnableOnWifiM(UFR_HANDLE hndUFR); + + /** + * @brief Function sets service data into eeprom. Only use with production firmware. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param hndUFR handle of the uFR device + * @param data pointer to array of 5 bytes which contains new service data + * @return Operation status + */ + UFR_STATUS DL_API SetServiceDataM(UFR_HANDLE hndUFR, IN uint8_t *data); + + /** + * @brief Function gets service data from eeprom. Use in diagnostic tool. + * @since uFCoder library version 6.0.9 + * + * @ingroup INTERNAL + * @param hndUFR handle of the uFR device + * @param data pointer to array which contains service data + * @return Operation status + */ + UFR_STATUS DL_API GetServiceDataM(UFR_HANDLE hndUFR, OUT uint8_t *data); + + /** + * @brief Function gets number and types of the installed I2C devices at the reader + * @since uFCoder library version 6.0.18 + * + * @ingroup INTERNAL + * @param dev_num number of I2C devices found + * @param dev_bits bit array that represents types of I2C devices + * @return Operation status + */ + UFR_STATUS DL_API GetI2cDevicesStatusM(UFR_HANDLE hndUFR, uint8_t *dev_num, uint32_t *dev_bits); + + /** + * @brief Function gets lock status of the reader + * @since uFCoder library version 6.0.19 + * + * @ingroup INTERNAL + * @param lock_status + * @return Operation status + */ + UFR_STATUS DL_API GetReaderLockStatusM(UFR_HANDLE hndUFR, uint8_t *lock_status); + + /** + * @brief Function changes password at the NXP ICODE cards (provided passwords) + * @since uFCoder library version 6.0.13 + * + * @ingrup + * @param pwd_ident - Password Identifier + * @param current_password - pointer to the 4 bytes array that represents current password + * @param new_password - pointer to the 4 bytes array that represents new password + * @return Operation status + */ + UFR_STATUS DL_API icode_write_password_PK_M(UFR_HANDLE hndUFR, uint8_t pwd_ident, IN uint8_t *current_password, IN uint8_t *new_password); + + /** + * @brief Function changes password at the NXP ICODE cards (reader's passwords) + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param pwd_ident - Password Identifier + * @param current_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @param new_password_index - index of the current password in the reader's EEPROM (0 - 31) + * @return Operation status + */ + UFR_STATUS DL_API icode_write_passwordM(UFR_HANDLE hndUFR, uint8_t pwd_ident, uint8_t current_password_index, uint8_t new_password_index); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_page_PK_M(UFR_HANDLE hndUFR, IN uint8_t *read_password, IN uint8_t *write_password, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function defines the protection pointer address of the user memory to divide the user memory into two arbitrarily sized pages and defines the access conditions for the two pages. + * @since uFCoder library version 6.0.13 + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param protect_page_address - address of the user memory that divide memory into 2 pages L and H + * @param low_read_prot : 1 - page L is read protected, 0 - page L is not read protected + * @param low_write_prot : 1 - page L is write protected, 0 - page L is not write protected + * @param high_read_prot : 1 - page H is read protected, 0 - page H is not read protected + * @param hige_write_prot : 1 - page H is write protected, 0 - page H is not write protected + * @return Operation status + */ + UFR_STATUS DL_API icode_protect_pageM(UFR_HANDLE hndUFR, uint8_t read_pass_index, uint8_t write_pass_index, + uint8_t protect_page_address, uint8_t low_read_prot, uint8_t low_write_prot, uint8_t high_read_prot, uint8_t high_write_prot); + + /** + * @brief Function locks permanently the requested block on the ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API iso15693_lock_block_no_authM(UFR_HANDLE hndUFR, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_password - pointer to the 4 bytes array that represents read password + * @param write_password - pointer to the 4 bytes array that represents write password + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_block_PK_M(UFR_HANDLE hndUFR, IN uint8_t *read_password, IN uint8_t *write_password, uint8_t lock_block_address); + + /** + * @brief Function locks permanently the requested block on the ICODE cards with the READ and WRITE password protect. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param read_pass_index - index of the read password in the reader's EEPROM (0 - 31) + * @param write_pass_index - index of the write password in the reader's EEPROM (0 - 31) + * @param lock_block_address - address of the block wich will be permanently locked + * @return Operation status + */ + UFR_STATUS DL_API icode_lock_blockM(UFR_HANDLE hndUFR, uint8_t read_pass_index, uint8_t write_pass_index, uint8_t lock_block_address); + + /** + * @brief Function read the security status of the blocks from ISO15693 cards. + * @since uFCoder library version 6.0.15. + * + * @ingroup + * @param first_block - address of the first block for security status reading + * @param number_of_blocks - number of blocks for security status reading + * @param block_data - pointer to the array of blocks security status (1 - block locked, 0 - block not locked). + * @return Operation status + */ + UFR_STATUS DL_API iso15693_get_multiply_block_security_statusM(UFR_HANDLE hndUFR, uint8_t first_block, uint8_t number_of_blocks, OUT uint8_t *block_data); + + + /** + * @brief Multi reader support. As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General_M + * + * @param hndUFR handle of the uFR device + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + + + UFR_STATUS DL_API COMTransceiveM(UFR_HANDLE hndUFR, IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief As of uFCoder library v5.0.71 users can use COM protocol via uFCoder library by calling this method. It handles transmission of CMD and CMD_EXT commands and it handles RSP and RSP_EXT packets that are a response to the COM protocol commands. + * + * @ingroup Card_Tag_General + * + * @param cmd Pointer to array of CMD bytes for transmission. Last byte is the checksum. + * @param cmd_length Length of the CMD array, always set it to 7. + * @param cmd_ext Pointer to array of CMD_EXT bytes for transmission. Last byte is the checksum. + * @param cmd_ext_length If the length is greater than 0, CMD_EXT bytes will be transmitted. Otherwise they will not. This is the size of CMD_EXT array that will be sent to the reader. + * @param rsp Pointer to array of bytes containing RSP bytes. + * @param rsp_length Pointer to a variable holding how many RSP bytes have been received. + * @param rsp_ext Pointer to array of bytes containing RSP bytes. If greater than zero, RSP_EXT exists. + * @param rsp_ext_length Pointer to a variable holding how many RSP_EXT byte have been received. + * + * @return Operation status + */ + UFR_STATUS DL_API COMTransceive(IN uint8_t *cmd, uint32_t cmd_length, IN uint8_t *cmd_ext, uint32_t cmd_ext_length, OUT uint8_t *rsp, VAR uint32_t *rsp_length, OUT uint8_t *rsp_ext, VAR uint32_t *rsp_ext_length); + + // DLL version ---------------------------------------------------------------- + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + uint32_t DL_API GetDllVersion(void); + + /* + * Get "exploded" dll version example: + * + * #include + * #include + * + * void main(int argc, char *argv[]) + * { + * uint32_t dwDllVersion = 0; + * uint32_t dwDllMajorVersion = 0; + * uint32_t dwDllMinorVersion = 0; + * uint32_t dwDllBuild = 0; + * + * dwDllVersion = GetDllVersion(); + * + * // "explode" the dll version: + * dwDllMajorVersion = (DWORD)(LOBYTE(LOWORD(dwDllVersion))); + * dwDllMinorVersion = (DWORD)(HIBYTE(LOWORD(dwDllVersion))); + * + * // Get the dll build number. + * dwDllBuild = (DWORD)(HIWORD(dwDllVersion)); + * + * printf("Dll version is %ld.%ld (%ld)\n", dwDllMajorVersion, + * dwDllMinorVersion, + * dwDllBuild); + * } + * + */ + // Originality Check (performs the check is the chip on the card/tag NXP genuine): + /** + * @brief This function depends on OpenSSL crypto library. Since OpenSSL crypto library is dynamically linked during execution, the only prerequisite for a successful call to this function is that the libeay32.dll is in the current folder (valid for Windows) and / or libcrypto.so is in the environment path (e.g. LD_LIBRARY_PATH on Linux / macOS). OriginalityCheck() performs the check if the chip on the card / tag is NXP genuine. + * + * @ingroup Card_Tag_CardFeatures_OriginalityChecking + * + * @param signature ECCSignature acquired by call to the ReadECCSignature() function. + * @param uid Card UID. Best if the card UID is acquired by previous call to the ReadECCSignature() function. + * @param uid_len Card UID length. Best if the card UID length is acquired by previous call to the ReadECCSignature() function. + * @param DlogicCardType Card type. Best if the DlogicCardType is acquired by previous call to the ReadECCSignature() function. + * + * @return Operation status + */ + UFR_STATUS DL_API OriginalityCheck(IN const uint8_t *signature, IN const uint8_t *uid, uint8_t uid_len, uint8_t DlogicCardType); + // Returns: + // UFR_OPEN_SSL_DYNAMIC_LIB_NOT_FOUND in case there is no OpenSSL library (libeay32.dll) in current folder or path + // UFR_OPEN_SSL_DYNAMIC_LIB_FAILED in case of OpenSSL library error (e.g. wrong OpenSSL version) + // UFR_NOT_NXP_GENUINE if chip on the card/tag is NOT NXP genuine + // UFR_OK is chip on the card/tag is NXP GENUINE + + //// debug functions: + /** + * @brief This function returns library version as string. + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @return Operation status + */ + c_string DL_API GetDllVersionStr(void); + + /** + * @brief Returns UFR_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param status UFR_STATUS status variable + * + * @return Operation status + */ + c_string DL_API UFR_Status2String(const UFR_STATUS status); + + /** + * @brief Returns UFR_SESSION_STATUS error code as a c_string + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param session_status UFR_SESSION_STATUS status variable + * + * @return c_string value of the status code + */ + c_string DL_API UFR_SessionStatus2String(const UFR_SESSION_STATUS session_status); + + /** + * @brief Returns card type as a c_string instead of byte value + * + * @ingroup ReaderAndLibrary_HelperFunc + * + * @param dl_type_code card type value based on DLogic CardType enumeration + * + * @return Operation status + */ + c_string DL_API UFR_DLCardType2String(uint8_t dl_type_code); + +//// Helper functions: +#ifndef _WIN32 + + unsigned long GetTickCount(void); + +#endif // #ifndef _WIN32 + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + + /** + * @brief This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information + * + * @return The reader's descriptive name + */ + c_string DL_API GetReaderDescription(void); + + /** + * @brief Multi reader support. This function returns the reader's descriptive name. Return type is string. No parameters required. + * + * @ingroup ReaderAndLibrary_Information_M + * + * @param hndUFR handle of the uFR device + * + * @return Returns the reader's descriptive name. + */ + c_string DL_API GetReaderDescriptionM(UFR_HANDLE hndUFR); + + //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + +// #ifdef _WIN32 || __linux__ + +// #else +// #endif // _WIN32 + + + +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#ifdef __ANDROID__ +#include + + extern JNIEnv *global_env; + extern jclass global_class; + extern jclass usb_global_class; + + /** + + * + * @param env + * @param class1 + * + * @return Operation status + */ + void DL_API initVM(JNIEnv *env, jclass class1); +#endif + + + +#ifdef __APPLE__ +#include +#if TARGET_OS_IPHONE + typedef void (*CardDetectedCallback)(void *_Nonnull context, const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(void *_Nonnull context); + typedef void (*SessionErrorCallback)(void *_Nonnull context, UFR_SESSION_STATUS error_code, const char *error_description); + /** + * @brief For iOS only: This function is used to set message displayed when the NFC Session window is started
+ * E.g 'Read the tag with the phone' + * NFC Session can be started via ReaderOpenEx() and appropriate parameters, or openNFCSession() + * @since uFCoder library version 6.0.0 + * + * @ingroup Miscellaneous + * + * @return Operation status + */ + void setNFCMessage(const char *message); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * @param context pointer to UIView that bridges Swift with native code. e.g `let ble_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(void *_Nonnull context, const char *reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + void DL_API closeBLESession(void); + + /** + * @brief For iOS only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param context pointer to UIView that bridges Swift with native code. e.g `let nfc_context = Unmanaged.passUnretained(contentView).toOpaque()` + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(void *_Nonnull context, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char *license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); +#else + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); + +#endif // TARGET_OS_IPHONE +#endif // __APPLE__ + +#ifdef __ANDROID__ + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks via BLE.
+ * uFR Online reader only. Must be set in 'BLE' mode
+ * The function takes pointers to user-defined functions as 'card_detected_callback', 'card_removed_callback' and 'error_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param reader_sn uFR Online reader serial number (e.g ONXXXXXX) + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param session_error_callback TEST + * + * @return Operation status + */ + UFR_STATUS DL_API openBLESession(const char *reader_sn, int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openBLESession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeBLESession(void); + + /** + * @brief For Android only: This function is used to enable asynchronous event-driven API callbacks for internal NFC.
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param timeout session duration, how long it will keep receiving callbacks (in seconds) + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * @param error_callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * @param license_json JSON string containing full license data for offline use. Use the GetLicenseRequestData() and refer to additional documentation there on how to obtain an offline license. + * + * @return Operation status + */ + UFR_STATUS DL_API openNFCSession(int timeout, CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback, SessionErrorCallback error_callback, const char *license_json); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by openNFCSession() + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + void DL_API closeNFCSession(void); + + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + UFR_STATUS DL_API StopAsyncSession(); +#endif // __ANDROID__ + +#if defined(_WIN32) || defined(__linux__) + typedef void (*CardDetectedCallback)(const char *uid, const char *dl_card_type, const char *manufacturer); + typedef void (*CardRemovedCallback)(); + typedef void (*SessionErrorCallback)(UFR_SESSION_STATUS error_code, const char *error_description); + + /** + * @brief This function is used to enable asynchronous event-driven API callbacks.
+ * Prerequisites: ReaderOpen() or ReaderOpenEx() must be called first and must return `UFR_OK` status to open connection with the reader
+ * The function takes pointers to user-defined functions as 'card_detected_callback' and 'card_removed_callback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param card_detected_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * @param card_removed_callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + UFR_STATUS DL_API StartAsyncSession(CardDetectedCallback card_detected_callback, CardRemovedCallback card_removed_callback); + + /** + * @brief This function is used to stop receiving asynchronous callbacks previously set by StartAsyncSession() + * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @return Operation status + */ + UFR_STATUS DL_API StopAsyncSession(); + +#endif // _WIN32 || __linux__ + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardDetectedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardDetectedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardDetectedCallback(CardDetectedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'CardRemovedCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'CardRemovedCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setCardRemovedCallback(CardRemovedCallback callback); + + /** + * @brief This function is used to set or change the function that wil be called as a 'SessionErrorCallback'
+ * @since uFCoder library version 6.0.3 + * + * @ingroup ReaderAndLibrary_uFRSpecificFeatures_AsynchronousUIDSending + * + * @param callback Pointer to a function that user defines, signature of user-defined method must match the 'SessionErrorCallback' typedef defined in uFCoder.h + * + * @return Operation status + */ + void DL_API setSessionErrorCallback(SessionErrorCallback callback); + +#ifdef __cplusplus +} +#endif + +#endif /* uFCoder_H_ */ diff --git a/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/libuFCoder-ios_simulator-static.a b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/libuFCoder-ios_simulator-static.a new file mode 100644 index 0000000..551b59d Binary files /dev/null and b/ufr-lib/ios_framework/uFCoder.xcframework/ios-arm64_x86_64-simulator/libuFCoder-ios_simulator-static.a differ diff --git a/ufr-lib/ios_simulator/libuFCoder-ios_simulator-static.a b/ufr-lib/ios_simulator/libuFCoder-ios_simulator-static.a new file mode 100644 index 0000000..551b59d Binary files /dev/null and b/ufr-lib/ios_simulator/libuFCoder-ios_simulator-static.a differ diff --git a/ufr-lib/license/uFR_library_license.md b/ufr-lib/license/uFR_library_license.md new file mode 100644 index 0000000..158c8a3 --- /dev/null +++ b/ufr-lib/license/uFR_library_license.md @@ -0,0 +1,249 @@ +# LICENSE AGREEMENT /EN (the Serbian /SR version follows) + + +FOR µFR SERIES NFC READER’S LIBRARIES + +By: +Digital Logic Ltd. +Nemanjina 57A, Pozarevac, Serbia +Rev. 1.9 +July 2023 + + +## License + +1. Under this **Agreement**, **Digital Logic Ltd** (later in text **“Vendor”**) grants the non-exclusive and non-transferable **License** (later in text **"License"**) to its **users** (later in text **“Licensee”**), for the use of **µFR Series device’s Libraries** (later in text **“Libraries”**). + +2. To use these **Libraries**, Licensee must read and accept this **License Agreement**, and all its contents. Downloading and using **Libraries**, can also be considered as acceptance of this **License Agreement**. + +3. This License gives the **Licensees** the right to use/incorporate these **Libraries** in his own project and distribute it as such - only in accordance with the provisions of this License. + + +## Modifying and distributing the Libraries + +4. **Licensees** are entitled to use **Libraries** to fit their project needs as long as it complies with Paragraph 1 of this **Agreement** and other provisions of this License. + +5. **Licensees** can use/incorporate **Libraries** in his own project, and distribute it as such (sell, rent, give for free, or disclose in other way) as long as it complies with provisions of this **License**. + + +## License Fee and Restrictions + +6. **Licensees** which use these **Libraries** with any µFR Series device made by **Vendor** will be entitled to use them without any charge. + +7. For use with any other hardware (not made by **Vendor**), **Licensees** must contact **Vendor** for fees and terms of use. + +8. **Licensee** is forbidden to sell, publish, rent, disclose, or otherwise provide **Libraries** or any of its parts to any third party, except as expressly permitted in this License. + +9. **Licensee** is forbidden to use **Libraries** and/or its materials in any manner that would cause it to fall under any Open Source License. For example, **Licensee** is forbidden to incorporate the **Libraries** and/or its materials to an own project and then license it in whole under any Open Source or similar license, that way some of the restrictions prescribed by this License would be illegally revoked and **Licensee** would bear all responsibility for such a scenario. + +10. **Licensee** is forbidden to use **Libraries** in any illegal manner or use it to develop or transmit any malicious code, and is also obligated to comply with all national and international laws, rules, and regulations regarding its usage. + +11. **Licensee** is forbidden to make any use of the **Libraries** in any manner not permitted by this **Agreement**. + + +## Special terms of use of the uFCoder library +(use without uFR contactless card reader / programmer) + +Note: If you use the uFCoder library for Android or iOS platform with [µFR Series NFC devices](https://webshop.d-logic.net/products/nfc-rfid-reader-writer/ufr-series-dev-tools-with-sdk.html) from the Digital Logic product range - you do not have to pay any fee and are not subject to the conditions stated from paragraph 12 to 17. + + + +12. If you use the uFCoder library for Android or iOS platform without µFR Series NFC reader/programmer device, the following conditions apply: + +13. A dedicated licensing system has been developed for users who do not use devices from the uFR series of NFC readers. +Each user receives 10 free licenses, i.e. the opportunity to use the library for free on 10 different devices. +App package name and hardware ID generated by the Android or iOS environment is used for tracking the number of licenses used by the app with the same package name. Each user, when creating an application that uses the uFR Library, is obligated to define their own unique package name. + +14. If the User wants to use the library with the number of devices exceeding 10, he will be able to pay for additional licenses according to the following price list: + +Number of licenses - Monthly price per license/device + +1-10 - free +10-100 - 0.85 € without VAT per device +100-500 - 0.80 € ex. VAT per device +500-1000 - 0.75 € ex. VAT per device +1000+ - 0.70 € ex. VAT per device + +15. Invoicing is done at the end of the month for the number of devices (licenses) used by the library. The invoiced amount should be paid no later than 7 days from the date of the invoice. + +16. Upon request, the user can obtain a listing showing the number of accesses to the library by individual devices related to the User's package name. + +17. If the number of devices that use the library under the same package name exceeds 10 and the User does not apply for additional licenses or if he does not settle his outstanding balance on time, we reserve the right to terminate his ability to use the Library. + +18. Additional licensing information is available at: licensing@d-logic.com + +## Copyright and intellectual property + +19. All **Title**, **Copyright**, **Distribution**, **Intellectual** and **Property rights** remain exclusively with **Vendor**. This **Agreement** is only related to licensing of use and does not give **Licensee** any right to appropriate and/or transfer its ownership in any way. + +20. The **Libraries** may incorporate parts of **Code** from other **Vendors** under specific licenses which will always be visible and correctly emphasized in the accompanying documentation. + +21 Upon request, the source code of the library can be provided for the **Licensee**, with the obligatory conclusion of an NDA contract with the **Vendor**. + + +## Terms of Acceptance + +22. All terms, obligations, and conditions of this **Agreement** are deemed to be accepted by obtaining any version of the **Libraries** as subject to this license, either by download from **Vendor’s** website or any other way. + + +## Security + +23. **Licensees** are solely responsible for the application of the **Libraries** in their project, including security issues. This responsibility is related, but not limited to User personal data exposure. + + +## Limitation of Liability + +24. These **Libraries** are provided **"As is"** and **Vendor** makes **NO WARRANTIES**, expressed, implied, statutory or other. **Licensee** is in obligation to control, test and maintain the safety of its usage. + +25. **Vendor** will not be liable for any kind of damages arising from the usage of the **Libraries** and its materials whatsoever. Including, but not limited to: Profit Loss, Data loss, loss of use, Confidential Information exposure, Business Interruption, Personal Injury, Property Damage, or any other form of damage. + + +## Governing Law and Venue + +26. This **Agreement** will be governed by the Laws of the Republic of Serbia with jurisdiction and Venue of Serbian Court concerning any claims, proceedings, and lawsuits regarding this **License Agreement**. + + +## Modifications of the License Agreement + +27. **Vendor** reserves the right to change the contents of this **License Agreement**. All changes will be posted on **Vendor’s** official website included in new **License Agreement** revisions and will take in effect no sooner than 30 days after changes are posted. + + +## Contact information + +Vendor contact: +Digital Logic Ltd. +Nemanjina 57A +12000 Pozarevac +Serbia +Tel: +38112541022 +e-mail: legal@d-logic.com + + + +_________________________________________________________ + + + + +# UGOVOR O LICENCI /SR + + +ZA BIBLIOTEKE NFC ČITAČA SERIJE µFR + +Od strane: +Digital Logic Ltd. +Nemanjina 57A, Požarevac, Srbija +Rev. 1.9 +Jul 2023 + + +## Licenca + +1. Prema ovom **Ugovoru**, **Digital Logic Ltd** (dalje u tekstu **„Prodavac“**) daje neekskluzivnu i neprenosivu **Licencu** (dalje u tekstu **„Licenca“**) svojim **Korisnicima** (dalje u tekstu **„Korisnik licence“**), za korišćenje **Biblioteke** uređaja serije µFR (dalje u tekstu **„Biblioteke“**). + +2. Da bi koristio uFCoder **Biblioteke**, K**orisnik** **Licence** mora pročitati i prihvatiti ovaj **Ugovor** o licenciranju i sav njegov sadržaj. Preuzimanje i korišćenje **Biblioteka** takođe se smatra prihvatanjem ovog **Ugovora** o licenciranju. + +3. Ova **Licenca** daje **Korisniku licence** pravo da koristi/ugradi ove **Biblioteke** u sopstveni projekat i distribuira ih kao takve - isključivo u skladu sa odredbama predmetne **Licence**. + + +## Modifikovanje i distribucija biblioteka + +4. **Korisnici licence** imaju pravo da koriste **Biblioteke** za potrebe svog projekta sve dok je to u skladu sa Stavom 1. ovog **Ugovora** i drugim odredbama ove **Licence**. + +5. **Korisnik licence** može koristiti/ugraditi **Biblioteke** u sopstveni projekat i tako ih distribuira (prodaje, iznajmljuje, poklanja ili na drugi način obelodanjuje) sve dok je to u skladu sa odredbama ove **Licence**. + + +## Naknada za licencu i ograničenja + + +6. **Korisnici licenci** koji koriste ove biblioteke** sa bilo kojim uređajem serije µFR koje je proizveo **Prodavac** imaće pravo da ih koriste bez ikakve naknade. + +7. Uslovi za korišćenje **Biblioteka** sa bilo kojim drugim hardverom (koji nije proizveo **Prodavac**) nalaze se u sekciji "Posebni uslovi korišćenja uFCoder biblioteke" ovog **Ugovora**. + +8. **Korisniku licence** je zabranjeno da prodaje, poklanja, objavljuje, iznajmljuje ili na drugi način ustupa samostalne **Biblioteke** ili bilo koji njihov deo bilo kojoj trećoj strani, osim ako je to izričito dozvoljeno u ovoj **Licenci**. + +9. **Korisniku licence** je zabranjeno da koristi **Biblioteke** i/ili njihove materijale na bilo koji način koji bi doveo do toga da potpadne pod bilo koju licencu otvorenog koda (Open source licence). Na primer, **Korisniku licence** je zabranjeno da ugradi **Biblioteke** i/ili njene materijale u svoj projekat, a zatim ga u celini licencira pod bilo kojom licencom otvorenog koda ili sličnom licencom. Na taj način bi neka od ograničenja propisanih ovom **Licencom** bila nezakonito opozvana i **Korisnik licence** bi u takvom slučaju snosio svu odgovornost. + +10. **Korisniku licence** je zabranjeno da koristi **Biblioteke** na bilo koji nezakonit način ili da ih koristi za razvoj ili prenošenje zlonamernog koda, a takođe je u obavezi da poštuje sve nacionalne i međunarodne zakone, pravila i propise u vezi sa njihovim korišćenjem. + +11. **Korisniku licence** je zabranjeno da koristi **Biblioteke** na bilo koji način koji nije dozvoljen ovim **Ugovorom**. + + +## Posebni uslovi korišćenja uFCoder biblioteke +(korišćenje bez uFR čitača/ programatora beskontaktnih kartica) + +Napomena: Ukoliko koristite uFCoder **Biblioteku** za Android ili iOS platformu sa uređajima na koji je priključen neki od [uFR NFC čitača/programatora](https://webshop.d-logic.net/products/nfc-rfid-reader-writer/ufr-series-dev-tools-with-sdk.html) iz proizvodnog programa firme Digital Logic - ne plaćate bilo kakvu naknadu i na vas se ne odnose uslovi navedeni u paragrafima od 12 do 17. + + +12. Ukoliko koristite uFCoder **Biblioteku** za Android ili iOS platformu bez uređaja uFR serije primenjuju se sledeći uslovi: + +13. Za korisnike koji ne koriste uređaje iz uFR serije NFC čitača razvijen je namenski sistem licenciranja. +Svaki korisnik dobija 10 besplatnih licenci, odnosno mogućnost da besplatno koristi biblioteku na 10 različitih uređaja. +Package name aplikacije i Hardware ID koji generiše Android ili iOS okruženje, koriste se za praćenje broja licenci koje aplikacija koristi pozivajući se na isti naziv paketa (package name). Svaki korisnik, prilikom kreiranja aplikacije koja koristi uFR biblioteku, dužan je da definiše svoj jedinstven naziv paketa. + +14. Ukoliko **Korisnik** želi da **Biblioteku** koristi sa brojem uređaja koji prelazi 10 moći će da uplati dodatne licence po sledećem cenovniku: + +Broj licenci - Mesečna cena po licenci/uređaju + +1-10 - besplatno +10-100 - 0.85 € bez PDV-a po uređaju +100-500 - 0.80 € bez PDV-a po uređaju +500-1000 - 0.75 € bez PDV-a po uređaju +1000+ - 0.70 € bez PDV-a po uređaju + + +15. Fakturisanje se vrši na kraju meseca za broj uređaja (licenci) koji je koristio **Biblioteku**. Rok za plaćanje fakturisanog iznosa je najkasnije 7 dana od dana fakturisanja. + +16. Na zahtev, **Korisnik** može dobiti listing u kome se vidi broj pristupanja **Biblioteci** od strane pojedinačnih uređaja vezanih za **Korisnikov** package name. + +17. Ukoliko broj uređaja koji koriste **Biblioteku** pod istim package name-om pređe 10 a **Korisnik** ne podnese zahtev za davanje dodatnih **Licenci** ili ukoliko svoja dugovanja ne izmiri na vreme, zadržavamo pravo da mu ukinemo mogućnost korišćenja funkcija **Biblioteke**. + +18. Dodatne informacije u vezi licenciranja možete dobiti na adresu: licencing@d-logic.com + + +## Autorsko pravo i intelektualna svojina + +19. Sva prava na vlasništvo, autorska prava, distribuciju, intelektualna i imovinska prava ostaju isključivo u vlasništvu **Prodavca**. Ovaj **Ugovor** se odnosi samo na licenciranje korišćenja i ne daje **Korisniku licence** bilo kakvo pravo da prisvoji i/ili prenese vlasništvo na bilo koji način. + +20. **Biblioteke** mogu sadržati delove koda drugih autora pod određenim licencama koje će uvek biti vidljive i ispravno naglašene u pratećoj dokumentaciji. + +21. Na zahtev, izvorni kod biblioteke se može dostaviti **Korisniku licence**, uz obavezno zaključivanje NDA ugovora sa **Prodavcem**. + + +## Uslovi prihvatanja + +22. Smatra se da su svi uslovi, obaveze i uslovi ovog **Ugovora** prihvaćeni pribavljanjem bilo koje verzije **Biblioteka** koja podleže ovoj licenci, bilo preuzimanjem sa web lokacije prodavca ili na bilo koji drugi način. + + +## Bezbednost + +23. **Korisnici licence** su isključivo odgovorni za primenu **Biblioteka** u svom projektu, uključujući bezbednosna pitanja. Ova odgovornost se odnosi, ali ne ograničava, na izloženost ličnih padataka korisnika. + + +## Ograničenje odgovornosti + +24. Ove **Biblioteke** su obezbeđene „kao što jesu“ i **Prodavac** ne daje **NIKAKVE GARANCIJE**, izričite, podrazumevane, zakonske ili druge. **Korisnik licence** je u obavezi da kontroliše, testira i održava bezbednost njegovog korišćenja. + +25. **Prodavac** neće biti odgovoran za bilo kakvu štetu nastalu korišćenjem **Biblioteke** i njenih materijala. Uključujući, ali ne ograničavajući se na: gubitak dobiti, gubitak podataka, gubitak upotrebe, izlaganje poverljivim informacijama, prekid poslovanja, lične povrede, oštećenje imovine ili bilo koji drugi oblik štete. + + +## Merodavno pravo i mesto održavanja + +26. Ovaj **Ugovor** je vođen zakonima Republike Srbije sa nadležnim Sudom u Požarevcu - u vezi sa svim zahtevima, postupcima i tužbama u vezi sa ovim **Ugovorom** o licenci. + + +## Izmene Ugovora o licenci + +27. **Prodavac** zadržava pravo da promeni sadržaj ovog **Ugovora** o licenci. Sve promene će biti objavljene na zvaničnom veb sajtu **Prodavca** koje su uključene u nove revizije **Ugovora** o licenci i stupiće na snagu ne pre 30 dana nakon objavljivanja promena. + + +## Kontakt informacije + +Kontakt prodavca: +Digital Logic Ltd. +Nemanjina 57A +12000 Požarevac +Srbija +Tel: +38112541022 +e-mail: legal@d-logic.com + diff --git a/ufr-lib/linux/aarch64/libuFCoder-aarch64.so b/ufr-lib/linux/aarch64/libuFCoder-aarch64.so new file mode 100644 index 0000000..7c87606 Binary files /dev/null and b/ufr-lib/linux/aarch64/libuFCoder-aarch64.so differ diff --git a/ufr-lib/linux/arm-el/libuFCoder-armel.so b/ufr-lib/linux/arm-el/libuFCoder-armel.so new file mode 100644 index 0000000..df56ae3 Binary files /dev/null and b/ufr-lib/linux/arm-el/libuFCoder-armel.so differ diff --git a/ufr-lib/linux/arm-hf/libuFCoder-armhf.so b/ufr-lib/linux/arm-hf/libuFCoder-armhf.so new file mode 100644 index 0000000..025e4e0 Binary files /dev/null and b/ufr-lib/linux/arm-hf/libuFCoder-armhf.so differ diff --git a/ufr-lib/linux/static-aarch64/libuFCoder-aarch64.a b/ufr-lib/linux/static-aarch64/libuFCoder-aarch64.a new file mode 100644 index 0000000..35f3d9f Binary files /dev/null and b/ufr-lib/linux/static-aarch64/libuFCoder-aarch64.a differ diff --git a/ufr-lib/linux/static-armel/libuFCoder-armel.a b/ufr-lib/linux/static-armel/libuFCoder-armel.a new file mode 100644 index 0000000..c1c4cf9 Binary files /dev/null and b/ufr-lib/linux/static-armel/libuFCoder-armel.a differ diff --git a/ufr-lib/linux/static-armhf/libuFCoder-armhf.a b/ufr-lib/linux/static-armhf/libuFCoder-armhf.a new file mode 100644 index 0000000..22b99ef Binary files /dev/null and b/ufr-lib/linux/static-armhf/libuFCoder-armhf.a differ diff --git a/ufr-lib/linux/static-x86/libuFCoder-x86.a b/ufr-lib/linux/static-x86/libuFCoder-x86.a new file mode 100644 index 0000000..eaa6658 Binary files /dev/null and b/ufr-lib/linux/static-x86/libuFCoder-x86.a differ diff --git a/ufr-lib/linux/static-x86_64/libuFCoder-x86_64.a b/ufr-lib/linux/static-x86_64/libuFCoder-x86_64.a new file mode 100644 index 0000000..1252b15 Binary files /dev/null and b/ufr-lib/linux/static-x86_64/libuFCoder-x86_64.a differ diff --git a/ufr-lib/linux/static-x86_64/readme.txt b/ufr-lib/linux/static-x86_64/readme.txt new file mode 100644 index 0000000..9cae7bc --- /dev/null +++ b/ufr-lib/linux/static-x86_64/readme.txt @@ -0,0 +1,3 @@ +When you use uFCoder static library, you must define DL_USE_STATIC_LIB macro before include uFCoder.h + +Additionally, add following linker flags "-lpthread -ldl" diff --git a/ufr-lib/linux/x86/libuFCoder-x86.so b/ufr-lib/linux/x86/libuFCoder-x86.so new file mode 100644 index 0000000..03e026e Binary files /dev/null and b/ufr-lib/linux/x86/libuFCoder-x86.so differ diff --git a/ufr-lib/linux/x86_64/libuFCoder-x86_64.so b/ufr-lib/linux/x86_64/libuFCoder-x86_64.so new file mode 100644 index 0000000..bddacbb Binary files /dev/null and b/ufr-lib/linux/x86_64/libuFCoder-x86_64.so differ diff --git a/ufr-lib/macos/static-universal/libuFCoder-macos.a b/ufr-lib/macos/static-universal/libuFCoder-macos.a new file mode 100644 index 0000000..e064a59 Binary files /dev/null and b/ufr-lib/macos/static-universal/libuFCoder-macos.a differ diff --git a/ufr-lib/macos/static-universal/readme.txt b/ufr-lib/macos/static-universal/readme.txt new file mode 100644 index 0000000..bf13301 --- /dev/null +++ b/ufr-lib/macos/static-universal/readme.txt @@ -0,0 +1,3 @@ +When you use uFCoder static library, you must define DL_USE_STATIC_LIB macro before include uFCoder.h + +Additionally, add following linker flags "-framework IOKit -framework CoreFoundation" diff --git a/ufr-lib/macos/static-x86_64/libuFCoder-x86_64.a b/ufr-lib/macos/static-x86_64/libuFCoder-x86_64.a new file mode 100644 index 0000000..ac958bc Binary files /dev/null and b/ufr-lib/macos/static-x86_64/libuFCoder-x86_64.a differ diff --git a/ufr-lib/macos/static-x86_64/readme.txt b/ufr-lib/macos/static-x86_64/readme.txt new file mode 100644 index 0000000..bf13301 --- /dev/null +++ b/ufr-lib/macos/static-x86_64/readme.txt @@ -0,0 +1,3 @@ +When you use uFCoder static library, you must define DL_USE_STATIC_LIB macro before include uFCoder.h + +Additionally, add following linker flags "-framework IOKit -framework CoreFoundation" diff --git a/ufr-lib/macos/universal/libuFCoder-macos.dylib b/ufr-lib/macos/universal/libuFCoder-macos.dylib new file mode 100644 index 0000000..f56f510 Binary files /dev/null and b/ufr-lib/macos/universal/libuFCoder-macos.dylib differ diff --git a/ufr-lib/macos/x86_64/libuFCoder-x86_64.dylib b/ufr-lib/macos/x86_64/libuFCoder-x86_64.dylib new file mode 100644 index 0000000..c524f1d Binary files /dev/null and b/ufr-lib/macos/x86_64/libuFCoder-x86_64.dylib differ diff --git a/ufr-lib/windows/aarch64/readme.txt b/ufr-lib/windows/aarch64/readme.txt new file mode 100644 index 0000000..974ee79 --- /dev/null +++ b/ufr-lib/windows/aarch64/readme.txt @@ -0,0 +1,16 @@ +Install MSYS2 for x86_64 from: https://www.msys2.org/ +to obtain ARM64 toolchain. (necessary to compile from x86_64 PC for ARM64) + +-> Open `msys2.exe`, (path should be: “C:\msys64\msys2.exe”) +-> Update the package manager (pacman): `pacman -Syu` +-> Install the ARM64 toolchain: `pacman -S mingw-w64-aarch64-toolchain` +-> This installs: + mingw-w64-aarch64-gcc (GCC compiler for ARM64) + mingw-w64-aarch64-binutils (linker, assembler, etc.) + mingw-w64-aarch64-headers (Windows API headers) + mingw-w64-aarch64-crt (C runtime for ARM64) +-> Verify installation, from MSYS2 shell: “aarch64-w64-mingw32-gcc --version” + +Linking: +- Simply name the linker search patch to library and header file directories, e.g +` aarch64-w64-mingw32-gcc -O3 -D__USE_MINGW_ANSI_STDIO -Iufr-lib/include -Lufr-lib/windows/aarch64 -luFCoder-aarch64 *.c -o ufr.exe \ No newline at end of file diff --git a/ufr-lib/windows/aarch64/uFCoder-aarch64.def b/ufr-lib/windows/aarch64/uFCoder-aarch64.def new file mode 100644 index 0000000..c0dc55b --- /dev/null +++ b/ufr-lib/windows/aarch64/uFCoder-aarch64.def @@ -0,0 +1,4311 @@ +EXPORTS + AES_decrypt @1 + AES_encrypt @2 + AES_options @3 + AES_set_decrypt_key @4 + AES_set_encrypt_key @5 + AES_to_DES_key_type @6 + AES_version @7 DATA + APDUHexStrTransceive @8 + APDUHexStrTransceiveHnd @9 + APDUHexStrTransceiveM @10 + APDUPlainTransceive @11 + APDUPlainTransceiveHnd @12 + APDUPlainTransceiveM @13 + APDUPlainTransceiveToHeap @14 + APDUPlainTransceiveToHeapHnd @15 + APDUPlainTransceiveToHeapM @16 + APDUTransceive @17 + APDUTransceiveForceExtendedHnd @18 + APDUTransceiveHnd @19 + APDUTransceiveM @20 + APDU_switch_off_from_ISO7816_interface @21 + APDU_switch_off_from_ISO7816_interfaceHnd @22 + APDU_switch_off_from_ISO7816_interfaceM @23 + APDU_switch_to_ISO14443_4_interface @24 + APDU_switch_to_ISO14443_4_interfaceHnd @25 + APDU_switch_to_ISO14443_4_interfaceM @26 + APDU_switch_to_ISO7816_interface @27 + APDU_switch_to_ISO7816_interfaceHnd @28 + APDU_switch_to_ISO7816_interfaceM @29 + ATECC608LockConfig @30 + ATECC608LockConfigHnd @31 + ATECC608LockConfigM @32 + ATECC608LockDataAndOtp @33 + ATECC608LockDataAndOtpHnd @34 + ATECC608LockDataAndOtpM @35 + ATECC608LockKeySlot @36 + ATECC608LockKeySlotHnd @37 + ATECC608LockKeySlotM @38 + AdHocEmulationStart @39 + AdHocEmulationStartHnd @40 + AdHocEmulationStartM @41 + AdHocEmulationStop @42 + AdHocEmulationStopHnd @43 + AdHocEmulationStopM @44 + AutoSleepGet @45 + AutoSleepGetHnd @46 + AutoSleepGetM @47 + AutoSleepSet @48 + AutoSleepSetHnd @49 + AutoSleepSetM @50 + BalanceGet @51 + BalanceGetM @52 + BalanceSet @53 + BalanceSetM @54 + BlockInSectorRead @55 + BlockInSectorReadHnd @56 + BlockInSectorReadM @57 + BlockInSectorReadSamKey @58 + BlockInSectorReadSamKeyHnd @59 + BlockInSectorReadSamkeyM @60 + BlockInSectorRead_AKM1 @61 + BlockInSectorRead_AKM1Hnd @62 + BlockInSectorRead_AKM1M @63 + BlockInSectorRead_AKM2 @64 + BlockInSectorRead_AKM2Hnd @65 + BlockInSectorRead_AKM2M @66 + BlockInSectorRead_PK @67 + BlockInSectorRead_PKHnd @68 + BlockInSectorRead_PKM @69 + BlockInSectorWrite @70 + BlockInSectorWriteHnd @71 + BlockInSectorWriteM @72 + BlockInSectorWriteSamKey @73 + BlockInSectorWriteSamKeyHnd @74 + BlockInSectorWriteSamkeyM @75 + BlockInSectorWrite_AKM1 @76 + BlockInSectorWrite_AKM1Hnd @77 + BlockInSectorWrite_AKM1M @78 + BlockInSectorWrite_AKM2 @79 + BlockInSectorWrite_AKM2Hnd @80 + BlockInSectorWrite_AKM2M @81 + BlockInSectorWrite_PK @82 + BlockInSectorWrite_PKHnd @83 + BlockInSectorWrite_PKM @84 + BlockRead @85 + BlockReadHnd @86 + BlockReadM @87 + BlockReadSamKey @88 + BlockReadSamKeyHnd @89 + BlockReadSamKeyM @90 + BlockRead_AKM1 @91 + BlockRead_AKM1Hnd @92 + BlockRead_AKM1M @93 + BlockRead_AKM2 @94 + BlockRead_AKM2Hnd @95 + BlockRead_AKM2M @96 + BlockRead_PK @97 + BlockRead_PKHnd @98 + BlockRead_PKM @99 + BlockWrite @100 + BlockWriteHnd @101 + BlockWriteM @102 + BlockWriteSamKey @103 + BlockWriteSamKeyHnd @104 + BlockWriteSamKeyM @105 + BlockWrite_AKM1 @106 + BlockWrite_AKM1Hnd @107 + BlockWrite_AKM1M @108 + BlockWrite_AKM2 @109 + BlockWrite_AKM2Hnd @110 + BlockWrite_AKM2M @111 + BlockWrite_PK @112 + BlockWrite_PKHnd @113 + BlockWrite_PKM @114 + BootReader @115 + BootReaderHnd @116 + BusAdminCardMake @117 + BusAdminCardMakeHnd @118 + COMTransceive @119 + COMTransceiveHnd @120 + COMTransceiveM @121 + CRC16 @122 + CRC8 @123 + CalcChecksum @124 + CalcChecksum_D @125 + CardEncryption_GetActualCardSN @126 + CardEncryption_GetActualCardSNHnd @127 + CardEncryption_GetActualCardSNM @128 + CardEncryption_GetJobSN @129 + CardEncryption_GetJobSNHnd @130 + CardEncryption_GetJobSNM @131 + CardEncryption_GetJobSN_SalterSNHnd @132 + CardEncryption_GetNext @133 + CardEncryption_GetNextEncryptedCard @134 + CardEncryption_GetNextEncryptedCardHnd @135 + CardEncryption_GetNextEncryptedCardM @136 + CardEncryption_GetNextHnd @137 + CardEncryption_GetNextM @138 + CardEncryption_GetSalterSN @139 + CardEncryption_GetSalterSNHnd @140 + CardEncryption_GetSalterSNM @141 + CardEncryption_Initialize @142 + CardEncryption_InitializeHnd @143 + CardEncryption_InitializeM @144 + ChangeReaderJobId @145 + ChangeReaderJobIdHnd @146 + ChangeReaderJobIdM @147 + ChangeReaderPassword @148 + ChangeReaderPasswordHnd @149 + ChangeReaderPasswordM @150 + CheckUidChangeable @151 + CheckUidChangeableHnd @152 + CheckUidChangeableM @153 + CodeFrame @154 + CombinedModeEmulationStart @155 + CombinedModeEmulationStartHnd @156 + CombinedModeEmulationStartM @157 + CommonBlockInSectorRead_AKM @158 + CommonBlockInSectorWrite_AKM @159 + CommonBlockRead @160 + CommonBlockRead_AKM @161 + CommonBlockWrite @162 + CommonBlockWrite_AKM @163 + CommonLinearFormatCard_AKM @164 + CommonLinearRead @165 + CommonLinearWrite @166 + CommonSectorTrailerWriteUnsafe_AKM @167 + CommonSectorTrailerWrite_AKM @168 + DES_SPtrans @169 DATA + DES_cbc_encrypt @170 + DES_check_key_parity @171 + DES_decrypt3 @172 + DES_ecb_encrypt @173 + DES_encrypt1 @174 + DES_encrypt2 @175 + DES_encrypt3 @176 + DES_is_weak_key @177 + DES_key_sched @178 + DES_ncbc_encrypt @179 + DES_set_key @180 + DES_set_key_checked @181 + DES_set_key_unchecked @182 + DES_set_odd_parity @183 + DES_to_AES_key_type @184 + DLFree @185 + DLGetECCCurveDesignator @186 + DLGetECCCurveIndex @187 + DLGetEccCurveName @188 + DLGetHash @189 + DLGetHashName @190 + DLGetHashOutputByteLength @191 + DLGetHashToHeap @192 + DLGetSignatureSchemeName @193 + DLHashFinishChunked @194 + DLHashFinishChunkedToHeap @195 + DLHashInitChunked @196 + DLHashUpdateChunked @197 + DL_TLS_Request @198 + DL_TLS_SetClientCertificate @199 + DL_TLS_SetClientX509PrivateKey_PEM @200 + DLrealloc @201 + DLsprintf @202 + DataR @203 DATA + DataS @204 DATA + DefaultBaudrateFlashCheck @205 + DefaultBaudrateFlashCheckHnd @206 + DefaultBaudrateFlashCheckM @207 + DeslectCard @208 + DeslectCardHnd @209 + DeslectCardM @210 + DigitalSignatureVerifyHash @211 + DisableAntiCollision @212 + DisableAntiCollisionHnd @213 + DisableAntiCollisionM @214 + Display_ClearImage @215 + Display_EraseSection @216 + Display_EraseSectionHnd @217 + Display_PrintText @218 + Display_PrintTextHnd @219 + Display_SaveBitmapToGallery @220 + Display_SaveBitmapToGalleryHnd @221 + Display_SaveSystemBitmap @222 + Display_SaveSystemBitmapHnd @223 + Display_ShowBitmap @224 + Display_ShowBitmapFromGallery @225 + Display_ShowBitmapFromGalleryHnd @226 + Display_ShowBitmapHnd @227 + Display_ShowLastUnsavedImage @228 + Display_ShowLastUnsavedImageHnd @229 + Display_ShowTime @230 + Display_ShowTimeHnd @231 + Display_Transmit @232 + Display_TransmitHnd @233 + Display_UserInterfaceSignal @234 + Display_UserInterfaceSignalHnd @235 + EE_Lock @236 + EE_LockHnd @237 + EE_Password_Change @238 + EE_Password_ChangeHnd @239 + EE_Read @240 + EE_ReadHnd @241 + EE_Write @242 + EE_WriteHnd @243 + EMV_GetLastTransaction @244 + EMV_GetPAN @245 + EVP_cleanup @246 + EmulMirrorHnd @247 + EnableAntiCollision @248 + EnableAntiCollisionHnd @249 + EnableAntiCollisionM @250 + EnterShareRamCommMode @251 + EnterShareRamCommModeHnd @252 + EnterShareRamCommModeM @253 + EnumCards @254 + EnumCardsHnd @255 + EnumCardsM @256 + EspChangeReaderPassword @257 + EspChangeReaderPasswordHnd @258 + EspChangeReaderPasswordM @259 + EspDisableWifi @260 + EspDisableWifiHnd @261 + EspDisableWifiM @262 + EspEnableWifi @263 + EspEnableWifiHnd @264 + EspEnableWifiM @265 + EspGetFirmwareVersion @266 + EspGetFirmwareVersionHnd @267 + EspGetFirmwareVersionM @268 + EspGetIOState @269 + EspGetIOStateHnd @270 + EspGetIOStateM @271 + EspGetReaderSerialNumber @272 + EspGetReaderSerialNumberHnd @273 + EspGetReaderSerialNumberM @274 + EspGetReaderTime @275 + EspGetReaderTimeHnd @276 + EspGetReaderTimeM @277 + EspGetTransparentReaders @278 + EspGetTransparentReadersHnd @279 + EspReaderEepromRead @280 + EspReaderEepromReadHnd @281 + EspReaderEepromReadM @282 + EspReaderEepromWrite @283 + EspReaderEepromWriteHnd @284 + EspReaderEepromWriteM @285 + EspReaderReset @286 + EspReaderResetHnd @287 + EspReaderResetM @288 + EspSetDisplayData @289 + EspSetDisplayDataHnd @290 + EspSetDisplayDataM @291 + EspSetIOState @292 + EspSetIOStateHnd @293 + EspSetIOStateM @294 + EspSetReaderTime @295 + EspSetReaderTimeHnd @296 + EspSetReaderTimeM @297 + EspSetTransparentReader @298 + EspSetTransparentReaderHnd @299 + EspSetTransparentReaderM @300 + EspSetTransparentReaderSession @301 + EspSetTransparentReaderSessionHnd @302 + EspTurnOff @303 + EspTurnOffHnd @304 + EspTurnOffM @305 + ExitShareRamCommMode @306 + ExitShareRamCommModeHnd @307 + ExitShareRamCommModeM @308 + FT_Close @309 DATA + FT_ClrRts @310 DATA + FT_CreateDeviceInfoList @311 DATA + FT_EE_Read @312 DATA + FT_GetComPortNumber @313 DATA + FT_GetDeviceInfoDetail @314 DATA + FT_GetDriverVersion @315 DATA + FT_GetLatencyTimer @316 DATA + FT_GetQueueStatus @317 DATA + FT_ListDevices @318 DATA + FT_Open @319 DATA + FT_OpenEx @320 DATA + FT_Purge @321 DATA + FT_Read @322 DATA + FT_ResetDevice @323 DATA + FT_SetBaudRate @324 DATA + FT_SetBitMode @325 DATA + FT_SetDataCharacteristics @326 DATA + FT_SetFlowControl @327 DATA + FT_SetLatencyTimer @328 DATA + FT_SetRts @329 DATA + FT_SetTimeouts @330 DATA + FT_W32_ClearCommError @331 DATA + FT_Write @332 DATA + FastFlashCheck @333 + FastFlashCheckHnd @334 + FastFlashCheckM @335 + FrameR @336 DATA + FrameS @337 DATA + GUID_DEVCLASS_1394 @338 DATA + GUID_DEVCLASS_1394DEBUG @339 DATA + GUID_DEVCLASS_61883 @340 DATA + GUID_DEVCLASS_ADAPTER @341 DATA + GUID_DEVCLASS_APMSUPPORT @342 DATA + GUID_DEVCLASS_AVC @343 DATA + GUID_DEVCLASS_BATTERY @344 DATA + GUID_DEVCLASS_BIOMETRIC @345 DATA + GUID_DEVCLASS_BLUETOOTH @346 DATA + GUID_DEVCLASS_CAMERA @347 DATA + GUID_DEVCLASS_CDROM @348 DATA + GUID_DEVCLASS_COMPUTEACCELERATOR @349 DATA + GUID_DEVCLASS_COMPUTER @350 DATA + GUID_DEVCLASS_DECODER @351 DATA + GUID_DEVCLASS_DISKDRIVE @352 DATA + GUID_DEVCLASS_DISPLAY @353 DATA + GUID_DEVCLASS_DOT4 @354 DATA + GUID_DEVCLASS_DOT4PRINT @355 DATA + GUID_DEVCLASS_EHSTORAGESILO @356 DATA + GUID_DEVCLASS_ENUM1394 @357 DATA + GUID_DEVCLASS_EXTENSION @358 DATA + GUID_DEVCLASS_FDC @359 DATA + GUID_DEVCLASS_FIRMWARE @360 DATA + GUID_DEVCLASS_FLOPPYDISK @361 DATA + GUID_DEVCLASS_FSFILTER_ACTIVITYMONITOR @362 DATA + GUID_DEVCLASS_FSFILTER_ANTIVIRUS @363 DATA + GUID_DEVCLASS_FSFILTER_BOTTOM @364 DATA + GUID_DEVCLASS_FSFILTER_CFSMETADATASERVER @365 DATA + GUID_DEVCLASS_FSFILTER_COMPRESSION @366 DATA + GUID_DEVCLASS_FSFILTER_CONTENTSCREENER @367 DATA + GUID_DEVCLASS_FSFILTER_CONTINUOUSBACKUP @368 DATA + GUID_DEVCLASS_FSFILTER_COPYPROTECTION @369 DATA + GUID_DEVCLASS_FSFILTER_ENCRYPTION @370 DATA + GUID_DEVCLASS_FSFILTER_HSM @371 DATA + GUID_DEVCLASS_FSFILTER_INFRASTRUCTURE @372 DATA + GUID_DEVCLASS_FSFILTER_OPENFILEBACKUP @373 DATA + GUID_DEVCLASS_FSFILTER_PHYSICALQUOTAMANAGEMENT @374 DATA + GUID_DEVCLASS_FSFILTER_QUOTAMANAGEMENT @375 DATA + GUID_DEVCLASS_FSFILTER_REPLICATION @376 DATA + GUID_DEVCLASS_FSFILTER_SECURITYENHANCER @377 DATA + GUID_DEVCLASS_FSFILTER_SYSTEM @378 DATA + GUID_DEVCLASS_FSFILTER_SYSTEMRECOVERY @379 DATA + GUID_DEVCLASS_FSFILTER_TOP @380 DATA + GUID_DEVCLASS_FSFILTER_UNDELETE @381 DATA + GUID_DEVCLASS_FSFILTER_VIRTUALIZATION @382 DATA + GUID_DEVCLASS_GPS @383 DATA + GUID_DEVCLASS_HDC @384 DATA + GUID_DEVCLASS_HIDCLASS @385 DATA + GUID_DEVCLASS_HOLOGRAPHIC @386 DATA + GUID_DEVCLASS_IMAGE @387 DATA + GUID_DEVCLASS_INFINIBAND @388 DATA + GUID_DEVCLASS_INFRARED @389 DATA + GUID_DEVCLASS_KEYBOARD @390 DATA + GUID_DEVCLASS_LEGACYDRIVER @391 DATA + GUID_DEVCLASS_MEDIA @392 DATA + GUID_DEVCLASS_MEDIUM_CHANGER @393 DATA + GUID_DEVCLASS_MEMORY @394 DATA + GUID_DEVCLASS_MODEM @395 DATA + GUID_DEVCLASS_MONITOR @396 DATA + GUID_DEVCLASS_MOUSE @397 DATA + GUID_DEVCLASS_MTD @398 DATA + GUID_DEVCLASS_MULTIFUNCTION @399 DATA + GUID_DEVCLASS_MULTIPORTSERIAL @400 DATA + GUID_DEVCLASS_NET @401 DATA + GUID_DEVCLASS_NETCLIENT @402 DATA + GUID_DEVCLASS_NETDRIVER @403 DATA + GUID_DEVCLASS_NETSERVICE @404 DATA + GUID_DEVCLASS_NETTRANS @405 DATA + GUID_DEVCLASS_NODRIVER @406 DATA + GUID_DEVCLASS_PCMCIA @407 DATA + GUID_DEVCLASS_PNPPRINTERS @408 DATA + GUID_DEVCLASS_PORTS @409 DATA + GUID_DEVCLASS_PRINTER @410 DATA + GUID_DEVCLASS_PRINTERUPGRADE @411 DATA + GUID_DEVCLASS_PRINTQUEUE @412 DATA + GUID_DEVCLASS_PROCESSOR @413 DATA + GUID_DEVCLASS_SBP2 @414 DATA + GUID_DEVCLASS_SCMDISK @415 DATA + GUID_DEVCLASS_SCMVOLUME @416 DATA + GUID_DEVCLASS_SCSIADAPTER @417 DATA + GUID_DEVCLASS_SECURITYACCELERATOR @418 DATA + GUID_DEVCLASS_SENSOR @419 DATA + GUID_DEVCLASS_SIDESHOW @420 DATA + GUID_DEVCLASS_SMARTCARDREADER @421 DATA + GUID_DEVCLASS_SMRDISK @422 DATA + GUID_DEVCLASS_SMRVOLUME @423 DATA + GUID_DEVCLASS_SOFTWARECOMPONENT @424 DATA + GUID_DEVCLASS_SOUND @425 DATA + GUID_DEVCLASS_SYSTEM @426 DATA + GUID_DEVCLASS_TAPEDRIVE @427 DATA + GUID_DEVCLASS_UCM @428 DATA + GUID_DEVCLASS_UNKNOWN @429 DATA + GUID_DEVCLASS_USB @430 DATA + GUID_DEVCLASS_VOLUME @431 DATA + GUID_DEVCLASS_VOLUMESNAPSHOT @432 DATA + GUID_DEVCLASS_WCEUSBS @433 DATA + GUID_DEVCLASS_WPD @434 DATA + GetATECC608ConfigZone @435 + GetATECC608ConfigZoneHnd @436 + GetATECC608ConfigZoneM @437 + GetATECC608InfoRevision @438 + GetATECC608InfoRevisionHnd @439 + GetATECC608InfoRevisionM @440 + GetATECC608OtpZone @441 + GetATECC608OtpZoneHnd @442 + GetATECC608OtpZoneM @443 + GetATECC608SettingsHnd @444 + GetATECC608ZonesLockStatus @445 + GetATECC608ZonesLockStatusHnd @446 + GetATECC608ZonesLockStatusM @447 + GetAdHocEmulationParams @448 + GetAdHocEmulationParamsHnd @449 + GetAdHocEmulationParamsM @450 + GetAndTestResponseData @451 + GetAndTestResponseIntro @452 + GetAndTestResponseIntroSam @453 + GetAntiCollisionStatus @454 + GetAntiCollisionStatusHnd @455 + GetAntiCollisionStatusM @456 + GetAsyncCardIdSendConfig @457 + GetAsyncCardIdSendConfigEx @458 + GetAsyncCardIdSendConfigExHnd @459 + GetAsyncCardIdSendConfigExM @460 + GetAsyncCardIdSendConfigHnd @461 + GetAsyncCardIdSendConfigM @462 + GetAtqHnd @463 + GetAtqaSak @464 + GetAtqaSakM @465 + GetBuildNumber @466 + GetBuildNumberHnd @467 + GetBuildNumberM @468 + GetCardId @469 + GetCardIdEx @470 + GetCardIdExHnd @471 + GetCardIdExM @472 + GetCardIdHnd @473 + GetCardIdM @474 + GetCardManufacturer @475 + GetCardManufacturerHnd @476 + GetCardManufacturerM @477 + GetCardSize @478 + GetCardSizeHnd @479 + GetCardSizeM @480 + GetChecksumFragment @481 + GetChecksum_local @482 + GetCustomUiConfig @483 + GetCustomUiConfigHnd @484 + GetCustomUiConfigM @485 + GetDesfireCardUid @486 + GetDeviceDetails @487 + GetDiscoveryLoopSetup @488 + GetDiscoveryLoopSetupHnd @489 + GetDiscoveryLoopSetupM @490 + GetDisplayIntensity @491 + GetDisplayIntensityHnd @492 + GetDisplayIntensityM @493 + GetDllVersion @494 + GetDllVersionStr @495 + GetDlogicCardType @496 + GetDlogicCardTypeHnd @497 + GetDlogicCardTypeM @498 + GetExternalFieldState @499 + GetExternalFieldStateHnd @500 + GetExternalFieldStateM @501 + GetFeaturesSetupHnd @502 + GetFtdiDriverVersion @503 + GetFtdiDriverVersionM @504 + GetFtdiDriverVersionStr @505 + GetFtdiDriverVersionStrM @506 + GetI2cDevicesHnd @507 + GetI2cDevicesStatus @508 + GetI2cDevicesStatusM @509 + GetLastCardIdEx @510 + GetLastCardIdExHnd @511 + GetLastCardIdExM @512 + GetLicenseRequestData @513 + GetMimeType @514 + GetMobileAdditionalData @515 + GetMobileAdditionalDataHnd @516 + GetMobileAdditionalDataM @517 + GetMobileUniqueIdAid @518 + GetMobileUniqueIdAidHnd @519 + GetMobileUniqueIdAidM @520 + GetNfcT2TVersion @521 + GetNfcT2TVersionHnd @522 + GetNfcT2TVersionM @523 + GetReaderDescription @524 + GetReaderDescriptionHnd @525 + GetReaderDescriptionM @526 + GetReaderFirmwareVersion @527 + GetReaderFirmwareVersionHnd @528 + GetReaderFirmwareVersionM @529 + GetReaderHardwareVersion @530 + GetReaderHardwareVersionHnd @531 + GetReaderHardwareVersionM @532 + GetReaderInfo @533 + GetReaderLockStatus @534 + GetReaderLockStatusHnd @535 + GetReaderLockStatusM @536 + GetReaderParameters @537 + GetReaderParameters2Hnd @538 + GetReaderParametersDefaultBaudrate @539 + GetReaderParametersDefaultBaudrateHnd @540 + GetReaderParametersDefaultBaudrateM @541 + GetReaderParametersHnd @542 + GetReaderParametersM @543 + GetReaderParametersPN7462 @544 + GetReaderParametersPN7462_M @545 + GetReaderProMode @546 + GetReaderProModeHnd @547 + GetReaderProModeM @548 + GetReaderSerialDescription @549 + GetReaderSerialDescriptionHnd @550 + GetReaderSerialDescriptionM @551 + GetReaderSerialNumber @552 + GetReaderSerialNumberHnd @553 + GetReaderSerialNumberM @554 + GetReaderStatus @555 + GetReaderStatusEx @556 + GetReaderStatusExHnd @557 + GetReaderStatusExM @558 + GetReaderStatusHnd @559 + GetReaderStatusM @560 + GetReaderTime @561 + GetReaderTimeHnd @562 + GetReaderTimeM @563 + GetReaderType @564 + GetReaderTypeHnd @565 + GetReaderTypeM @566 + GetRfAnalogRegistersISO14443_212 @567 + GetRfAnalogRegistersISO14443_212Hnd @568 + GetRfAnalogRegistersISO14443_212M @569 + GetRfAnalogRegistersISO14443_424 @570 + GetRfAnalogRegistersISO14443_424Hnd @571 + GetRfAnalogRegistersISO14443_424M @572 + GetRfAnalogRegistersTypeA @573 + GetRfAnalogRegistersTypeAHnd @574 + GetRfAnalogRegistersTypeAM @575 + GetRfAnalogRegistersTypeATrans @576 + GetRfAnalogRegistersTypeATransHnd @577 + GetRfAnalogRegistersTypeATransM @578 + GetRfAnalogRegistersTypeB @579 + GetRfAnalogRegistersTypeBHnd @580 + GetRfAnalogRegistersTypeBM @581 + GetRfAnalogRegistersTypeBTrans @582 + GetRfAnalogRegistersTypeBTransHnd @583 + GetRfAnalogRegistersTypeBTransM @584 + GetRgbIntensity @585 + GetRgbIntensityM @586 + GetServiceData @587 + GetServiceDataHnd @588 + GetServiceDataM @589 + GetSpeedParameters @590 + GetSpeedParametersHnd @591 + GetSpeedParametersM @592 + GreenLedBlinkingTurnOff @593 + GreenLedBlinkingTurnOffHnd @594 + GreenLedBlinkingTurnOffM @595 + GreenLedBlinkingTurnOn @596 + GreenLedBlinkingTurnOnHnd @597 + GreenLedBlinkingTurnOnM @598 + IncrementCounter @599 + IncrementCounterHnd @600 + IncrementCounterM @601 + InitialHandshaking @602 + IsUSBDevicePresent @603 + JCAppDeleteEcKeyPair @604 + JCAppDeleteEcKeyPairHnd @605 + JCAppDeleteEcKeyPairM @606 + JCAppDeleteRsaKeyPair @607 + JCAppDeleteRsaKeyPairHnd @608 + JCAppDeleteRsaKeyPairM @609 + JCAppGenerateKeyPair @610 + JCAppGenerateKeyPairHnd @611 + JCAppGenerateKeyPairM @612 + JCAppGenerateSignature @613 + JCAppGenerateSignatureHnd @614 + JCAppGenerateSignatureM @615 + JCAppGetEcKeySizeBits @616 + JCAppGetEcKeySizeBitsHnd @617 + JCAppGetEcKeySizeBitsM @618 + JCAppGetEcPublicKey @619 + JCAppGetEcPublicKeyHnd @620 + JCAppGetEcPublicKeyM @621 + JCAppGetErrorDescription @622 + JCAppGetObj @623 + JCAppGetObjHnd @624 + JCAppGetObjId @625 + JCAppGetObjIdHnd @626 + JCAppGetObjIdM @627 + JCAppGetObjM @628 + JCAppGetObjSubject @629 + JCAppGetObjSubjectHnd @630 + JCAppGetObjSubjectM @631 + JCAppGetPinTriesRemaining @632 + JCAppGetPinTriesRemainingHnd @633 + JCAppGetPinTriesRemainingM @634 + JCAppGetRsaPublicKey @635 + JCAppGetRsaPublicKeyHnd @636 + JCAppGetRsaPublicKeyM @637 + JCAppGetSignature @638 + JCAppInvalidateCert @639 + JCAppInvalidateCertHnd @640 + JCAppInvalidateCertM @641 + JCAppLogin @642 + JCAppLoginHnd @643 + JCAppLoginM @644 + JCAppPinChange @645 + JCAppPinChangeHnd @646 + JCAppPinChangeM @647 + JCAppPinDisable @648 + JCAppPinDisableHnd @649 + JCAppPinDisableM @650 + JCAppPinEnable @651 + JCAppPinEnableHnd @652 + JCAppPinEnableM @653 + JCAppPinUnblock @654 + JCAppPinUnblockHnd @655 + JCAppPinUnblockM @656 + JCAppPutObj @657 + JCAppPutObjHnd @658 + JCAppPutObjM @659 + JCAppPutObjSubject @660 + JCAppPutObjSubjectHnd @661 + JCAppPutObjSubjectM @662 + JCAppPutPrivateKey @663 + JCAppPutPrivateKeyHnd @664 + JCAppPutPrivateKeyM @665 + JCAppSelectByAid @666 + JCAppSelectByAidHnd @667 + JCAppSelectByAidM @668 + JCAppSignatureBegin @669 + JCAppSignatureBeginHnd @670 + JCAppSignatureBeginM @671 + JCAppSignatureEnd @672 + JCAppSignatureEndHnd @673 + JCAppSignatureEndM @674 + JCAppSignatureUpdate @675 + JCAppSignatureUpdateHnd @676 + JCAppSignatureUpdateM @677 + JCCheckEcdsaKeySize @678 + JCCheckEcdsaOnCardKeyGen @679 + JCCheckRsaKeySize @680 + JCCheckRsaOnCardKeyGen @681 + JCCheckSignerAlgorithms @682 + JCStorageDeleteFile @683 + JCStorageDeleteFileHnd @684 + JCStorageDeleteFileM @685 + JCStorageGetFileSize @686 + JCStorageGetFileSizeHnd @687 + JCStorageGetFileSizeM @688 + JCStorageGetFilesListSize @689 + JCStorageGetFilesListSizeHnd @690 + JCStorageGetFilesListSizeM @691 + JCStorageListFiles @692 + JCStorageListFilesHnd @693 + JCStorageListFilesM @694 + JCStorageReadFile @695 + JCStorageReadFileHnd @696 + JCStorageReadFileM @697 + JCStorageReadFileToFileSystem @698 + JCStorageReadFileToFileSystemHnd @699 + JCStorageReadFileToFileSystemM @700 + JCStorageWriteFile @701 + JCStorageWriteFileFromFileSystem @702 + JCStorageWriteFileFromFileSystemHnd @703 + JCStorageWriteFileFromFileSystemM @704 + JCStorageWriteFileHnd @705 + JCStorageWriteFileM @706 + JSONEscapeString @707 + KARATSUBA_MUL_CUTOFF @708 DATA + KARATSUBA_SQR_CUTOFF @709 DATA + LinRowRead @710 + LinRowReadHnd @711 + LinRowReadM @712 + LinRowRead_AKM1 @713 + LinRowRead_AKM1Hnd @714 + LinRowRead_AKM1M @715 + LinRowRead_AKM2 @716 + LinRowRead_AKM2Hnd @717 + LinRowRead_AKM2M @718 + LinRowRead_PK @719 + LinRowRead_PKHnd @720 + LinRowRead_PKM @721 + LinearFormatCard @722 + LinearFormatCardHnd @723 + LinearFormatCardM @724 + LinearFormatCard_AKM1 @725 + LinearFormatCard_AKM1Hnd @726 + LinearFormatCard_AKM1M @727 + LinearFormatCard_AKM2 @728 + LinearFormatCard_AKM2Hnd @729 + LinearFormatCard_AKM2M @730 + LinearFormatCard_PK @731 + LinearFormatCard_PKHnd @732 + LinearFormatCard_PKM @733 + LinearRead @734 + LinearReadHnd @735 + LinearReadM @736 + LinearReadSamKey @737 + LinearReadSamKeyHnd @738 + LinearReadSamKeyM @739 + LinearRead_AKM1 @740 + LinearRead_AKM1Hnd @741 + LinearRead_AKM1M @742 + LinearRead_AKM2 @743 + LinearRead_AKM2Hnd @744 + LinearRead_AKM2M @745 + LinearRead_PK @746 + LinearRead_PKHnd @747 + LinearRead_PKM @748 + LinearWrite @749 + LinearWriteHnd @750 + LinearWriteM @751 + LinearWriteSamKey @752 + LinearWriteSamKeyHnd @753 + LinearWriteSamKeyM @754 + LinearWrite_AKM1 @755 + LinearWrite_AKM1Hnd @756 + LinearWrite_AKM1M @757 + LinearWrite_AKM2 @758 + LinearWrite_AKM2Hnd @759 + LinearWrite_AKM2M @760 + LinearWrite_PK @761 + LinearWrite_PKHnd @762 + LinearWrite_PKM @763 + ListCards @764 + ListCardsHnd @765 + ListCardsM @766 + ListUSBDevices @767 + LoadFTD2XXLibrary @768 + MFP_AesAuthSecurityLevel1 @769 + MFP_AesAuthSecurityLevel1Hnd @770 + MFP_AesAuthSecurityLevel1M @771 + MFP_AesAuthSecurityLevel1_PK @772 + MFP_AesAuthSecurityLevel1_PKHnd @773 + MFP_AesAuthSecurityLevel1_PKM @774 + MFP_ChangeConfigurationKey @775 + MFP_ChangeConfigurationKeyHnd @776 + MFP_ChangeConfigurationKeyM @777 + MFP_ChangeConfigurationKeySamHnd @778 + MFP_ChangeConfigurationKeySamKey @779 + MFP_ChangeConfigurationKeySamKeyM @780 + MFP_ChangeConfigurationKey_PK @781 + MFP_ChangeConfigurationKey_PKHnd @782 + MFP_ChangeConfigurationKey_PKM @783 + MFP_ChangeMasterKey @784 + MFP_ChangeMasterKeyHnd @785 + MFP_ChangeMasterKeyM @786 + MFP_ChangeMasterKeySamHnd @787 + MFP_ChangeMasterKeySamKey @788 + MFP_ChangeMasterKeySamKeyM @789 + MFP_ChangeMasterKey_PK @790 + MFP_ChangeMasterKey_PKHnd @791 + MFP_ChangeMasterKey_PKM @792 + MFP_ChangeSectorExtKey @793 + MFP_ChangeSectorExtKeyM @794 + MFP_ChangeSectorKey @795 + MFP_ChangeSectorKeyExt_PK @796 + MFP_ChangeSectorKeyExt_PKM @797 + MFP_ChangeSectorKeyHnd @798 + MFP_ChangeSectorKeyM @799 + MFP_ChangeSectorKeySamExtKey @800 + MFP_ChangeSectorKeySamExtKeyM @801 + MFP_ChangeSectorKeySamHnd @802 + MFP_ChangeSectorKeySamKey @803 + MFP_ChangeSectorKeySamKeyM @804 + MFP_ChangeSectorKey_PK @805 + MFP_ChangeSectorKey_PKHnd @806 + MFP_ChangeSectorKey_PKM @807 + MFP_ChangeVcPollingEncKey @808 + MFP_ChangeVcPollingEncKeyHnd @809 + MFP_ChangeVcPollingEncKeyM @810 + MFP_ChangeVcPollingEncKeySamHnd @811 + MFP_ChangeVcPollingEncKeySamKey @812 + MFP_ChangeVcPollingEncKeySamKeyM @813 + MFP_ChangeVcPollingEncKey_PK @814 + MFP_ChangeVcPollingEncKey_PKHnd @815 + MFP_ChangeVcPollingEncKey_PKM @816 + MFP_ChangeVcPollingMacKey @817 + MFP_ChangeVcPollingMacKeyHnd @818 + MFP_ChangeVcPollingMacKeyM @819 + MFP_ChangeVcPollingMacKeySamHnd @820 + MFP_ChangeVcPollingMacKeySamKey @821 + MFP_ChangeVcPollingMacKeySamKeyM @822 + MFP_ChangeVcPollingMacKey_PK @823 + MFP_ChangeVcPollingMacKey_PKHnd @824 + MFP_ChangeVcPollingMacKey_PKM @825 + MFP_CommitPerso @826 + MFP_CommitPersoHnd @827 + MFP_CommitPersoM @828 + MFP_Error_codes @829 + MFP_FieldConfigurationSet @830 + MFP_FieldConfigurationSetHnd @831 + MFP_FieldConfigurationSetM @832 + MFP_FieldConfigurationSetSamHnd @833 + MFP_FieldConfigurationSetSamKey @834 + MFP_FieldConfigurationSetSamKeyM @835 + MFP_FieldConfigurationSet_PK @836 + MFP_FieldConfigurationSet_PKHnd @837 + MFP_FieldConfigurationSet_PKM @838 + MFP_GetUid @839 + MFP_GetUidHnd @840 + MFP_GetUidM @841 + MFP_GetUidSamHnd @842 + MFP_GetUidSamKey @843 + MFP_GetUidSamKeyM @844 + MFP_GetUid_PK @845 + MFP_GetUid_PKHnd @846 + MFP_GetUid_PKM @847 + MFP_PersonalizationMinimal @848 + MFP_PersonalizationMinimalHnd @849 + MFP_PersonalizationMinimalM @850 + MFP_SwitchToSecurityLevel3 @851 + MFP_SwitchToSecurityLevel3Hnd @852 + MFP_SwitchToSecurityLevel3M @853 + MFP_SwitchToSecurityLevel3_PK @854 + MFP_SwitchToSecurityLevel3_PKHnd @855 + MFP_SwitchToSecurityLevel3_PKM @856 + MFP_WritePerso @857 + MFP_WritePersoHnd @858 + MFP_WritePersoM @859 + MRTDAppSelectAndAuthenticateBac @860 + MRTDAppSelectAndAuthenticateBacHnd @861 + MRTDAppSelectAndAuthenticateBacM @862 + MRTDFileReadBacToHeap @863 + MRTDFileReadBacToHeapHnd @864 + MRTDFileReadBacToHeapM @865 + MRTDGetDGTagListFromCOM @866 + MRTDGetDgIndex @867 + MRTDGetDgName @868 + MRTDGetImageFromDG2 @869 + MRTDGetImageFromDG2ToFile @870 + MRTDParseDG1ToHeap @871 + MRTDValidate @872 + MRTDValidateHnd @873 + MRTDValidateM @874 + MRTD_MRZCheck @875 + MRTD_MRZDataToMRZProtoKey @876 + MRTD_MRZDetectFormat @877 + MRTD_MRZSubjacentCheck @878 + MRTD_MRZSubjacentToMRZProtoKey @879 + MRTD_ReadDocumentData @880 + MRTD_ReadDocumentDataHnd @881 + MRTD_SOD_CertToHeap @882 + MRTD_SOD_CertToHeapHnd @883 + MRTD_SOD_CertToHeapM @884 + MRTD_SessionClose @885 + MRTD_SessionCloseHnd @886 + MRTD_SessionInit @887 + MRTD_SessionInitHnd @888 + MRZDataToJSON @889 + MRZSprintfDataTD1Format @890 + MRZSprintfDataTD2Format @891 + MRZSprintfDataTD3Format @892 + MRZToDate @893 + MRZToSpace @894 + MRZToSpaceTrim @895 + NDEF_ParseCC @896 + NfcT2TSafeConvertVersion @897 + OSSL_DES_version @898 DATA + OSSL_libdes_version @899 DATA + OldWriteEmulationNdefHnd @900 + OpenOnlineReader_auto @901 + OpenSSL_add_all_algorithms @902 + OpenSSL_add_all_ciphers @903 + OpenSSL_add_all_digests @904 + Open_ISO7816_Generic @905 + Open_ISO7816_GenericM @906 + OriginalityCheck @907 + OutputData @908 DATA + OutputFrame @909 DATA + PN7462_CodeProtect @910 + PN7462_CodeProtectHnd @911 + PN7462_ESP32_boot_init @912 + PN7462_ESP32_boot_init_hnd @913 + PN7462_ExtField @914 + PN7462_ExtFieldHnd @915 + PN7462_LpcdCalibration @916 + PN7462_LpcdCalibrationHnd @917 + PN7462_LpcdPerform @918 + PN7462_LpcdPerformHnd @919 + PN7462_RfOff @920 + PN7462_RfOn @921 + PN7462_RfOnOffHnd @922 + PN7462_SetSpeakerFrequencyHnd @923 + PN7462_Test @924 + PN7462_TestHnd @925 + PN7462_WriteParams @926 + PN7462_WriteParamsHnd @927 + PN7462_WriteParamsUsb @928 + PN7462_WriteParamsUsbHnd @929 + ParamTest1 @930 + ParamTest2 @931 + ParseNdefMessage @932 + ParseTD1Format @933 + ParseTD3Format @934 + PiccDesfireGetVersion @935 + PortClose @936 + PortDefaultBaudRateOpen @937 + PortFtdiDefaultBaudRateOpen @938 + PortGetAvailable @939 + PortOpen_by @940 + PortOpen_byCOM @941 + PortOpen_byFTDI @942 + PortPurge @943 + PortRead @944 + PortRead1 @945 + PortSetBaudRate @946 + PortSetRTS @947 + PortSetTimeout @948 + PortWrite @949 + ProgReader @950 + ProgReaderHnd @951 + ProgReaderStreamUsb @952 + ProgReaderStreamUsbHnd @953 + ProgReaderUsb @954 + ProgReaderUsbHnd @955 + RTS_check_inverted @956 + RamTagEmulationStartHnd @957 + RamTagEmulationStopHnd @958 + RamWriteEmulationNdefHnd @959 + ReadCounter @960 + ReadCounterHnd @961 + ReadCounterM @962 + ReadECCSignature @963 + ReadECCSignatureDesfireHnd @964 + ReadECCSignatureExt @965 + ReadECCSignatureExtHnd @966 + ReadECCSignatureExtM @967 + ReadECCSignatureHnd @968 + ReadECCSignatureM @969 + ReadECCSignatureNtagDnaHnd @970 + ReadNFCCounter @971 + ReadNFCCounterM @972 + ReadNFCCounterPwdAuth_PK @973 + ReadNFCCounterPwdAuth_PKM @974 + ReadNFCCounterPwdAuth_RK @975 + ReadNFCCounterPwdAuth_RKM @976 + ReadNdefRecord_Address @977 + ReadNdefRecord_AddressHnd @978 + ReadNdefRecord_AddressM @979 + ReadNdefRecord_AndroidApp @980 + ReadNdefRecord_AndroidAppHnd @981 + ReadNdefRecord_AndroidAppM @982 + ReadNdefRecord_BT @983 + ReadNdefRecord_BTHnd @984 + ReadNdefRecord_BTM @985 + ReadNdefRecord_Bitcoin @986 + ReadNdefRecord_BitcoinHnd @987 + ReadNdefRecord_BitcoinM @988 + ReadNdefRecord_Contact @989 + ReadNdefRecord_ContactHnd @990 + ReadNdefRecord_ContactM @991 + ReadNdefRecord_Email @992 + ReadNdefRecord_EmailHnd @993 + ReadNdefRecord_EmailM @994 + ReadNdefRecord_GeoLocation @995 + ReadNdefRecord_GeoLocationHnd @996 + ReadNdefRecord_GeoLocationM @997 + ReadNdefRecord_NaviDestination @998 + ReadNdefRecord_NaviDestinationHnd @999 + ReadNdefRecord_NaviDestinationM @1000 + ReadNdefRecord_Phone @1001 + ReadNdefRecord_PhoneHnd @1002 + ReadNdefRecord_PhoneM @1003 + ReadNdefRecord_SMS @1004 + ReadNdefRecord_SMSHnd @1005 + ReadNdefRecord_SMSM @1006 + ReadNdefRecord_Skype @1007 + ReadNdefRecord_SkypeHnd @1008 + ReadNdefRecord_SkypeM @1009 + ReadNdefRecord_StreetView @1010 + ReadNdefRecord_StreetViewHnd @1011 + ReadNdefRecord_StreetViewM @1012 + ReadNdefRecord_Text @1013 + ReadNdefRecord_TextHnd @1014 + ReadNdefRecord_TextM @1015 + ReadNdefRecord_Viber @1016 + ReadNdefRecord_ViberHnd @1017 + ReadNdefRecord_ViberM @1018 + ReadNdefRecord_Whatsapp @1019 + ReadNdefRecord_WhatsappHnd @1020 + ReadNdefRecord_WhatsappM @1021 + ReadNdefRecord_WiFi @1022 + ReadNdefRecord_WiFiHnd @1023 + ReadNdefRecord_WiFiM @1024 + ReadShareRam @1025 + ReadShareRamHnd @1026 + ReadShareRamM @1027 + ReadTTStatus @1028 + ReadTTStatusHnd @1029 + ReadTTStatusM @1030 + ReadUserData @1031 + ReadUserDataExt @1032 + ReadUserDataExtM @1033 + ReadUserDataHnd @1034 + ReadUserDataM @1035 + ReaderClose @1036 + ReaderCloseHnd @1037 + ReaderCloseM @1038 + ReaderEepromRead @1039 + ReaderEepromReadHnd @1040 + ReaderEepromReadM @1041 + ReaderEepromWrite @1042 + ReaderEepromWriteHnd @1043 + ReaderEepromWriteM @1044 + ReaderHwReset @1045 + ReaderHwRestartHnd @1046 + ReaderKeyWrite @1047 + ReaderKeyWriteHnd @1048 + ReaderKeyWriteM @1049 + ReaderKeysLock @1050 + ReaderKeysLockHnd @1051 + ReaderKeysLockM @1052 + ReaderKeysUnlock @1053 + ReaderKeysUnlockHnd @1054 + ReaderKeysUnlockM @1055 + ReaderList_Add @1056 + ReaderList_Destroy @1057 + ReaderList_GetFTDIDescriptionByIndex @1058 + ReaderList_GetFTDISerialByIndex @1059 + ReaderList_GetInformation @1060 + ReaderList_GetSerialByIndex @1061 + ReaderList_GetSerialDescriptionByIndex @1062 + ReaderList_GetTypeByIndex @1063 + ReaderList_OpenByIndex @1064 + ReaderList_OpenBySerial @1065 + ReaderList_UpdateAndGetCount @1066 + ReaderOpen @1067 + ReaderOpenByFTDIIndex @1068 + ReaderOpenByIdxSpeed @1069 + ReaderOpenByType @1070 + ReaderOpenByTypeNIndex @1071 + ReaderOpenEx @1072 + ReaderOpenExHnd @1073 + ReaderOpenHnd @1074 + ReaderOpenHnd_FtdiRS232 @1075 + ReaderOpenHnd_FtdiUSB @1076 + ReaderOpenHnd_FtdiUfr @1077 + ReaderOpenHnd_Serial @1078 + ReaderOpenHnd_ZeroUSB @1079 + ReaderOpenM @1080 + ReaderOpen_uFROnline @1081 + ReaderOpen_uFROnlineHnd @1082 + ReaderReset @1083 + ReaderResetHnd @1084 + ReaderResetM @1085 + ReaderResetNoWaitFWHnd @1086 + ReaderResetOffHnd @1087 + ReaderResetOnHnd @1088 + ReaderResetSetHnd @1089 + ReaderResetWait @1090 + ReaderResetWaitHnd @1091 + ReaderRfOff @1092 + ReaderRfOffM @1093 + ReaderRfOn @1094 + ReaderRfOnM @1095 + ReaderRfReset @1096 + ReaderRfResetHnd @1097 + ReaderRfResetM @1098 + ReaderSoftRestart @1099 + ReaderSoftRestartHnd @1100 + ReaderSoftRestartM @1101 + ReaderSoundHnd @1102 + ReaderSoundVolume @1103 + ReaderSoundVolumeM @1104 + ReaderStillConnected @1105 + ReaderStillConnectedHnd @1106 + ReaderStillConnectedM @1107 + ReaderUISignal @1108 + ReaderUISignalHnd @1109 + ReaderUISignalM @1110 + ReaderWaitForBootSeqHnd @1111 + RgbControl @1112 + RgbControlM @1113 + RgbIdleDefault @1114 + RgbIdleDefaultM @1115 + RgbIdleSet @1116 + RgbIdleSetM @1117 + RgbInternalOffHnd @1118 + RgbInternalOnHnd @1119 + RgbInternalTurnOff @1120 + RgbInternalTurnOffM @1121 + RgbInternalTurnOn @1122 + RgbInternalTurnOnM @1123 + SAM_authenticate_host_AV2_Hnd @1124 + SAM_authenticate_host_AV2_plain @1125 + SAM_authenticate_host_AV2_plainM @1126 + SAM_authenticate_host_no_div_des @1127 + SAM_authenticate_host_no_div_desM @1128 + SAM_authenticate_host_no_div_des_Hnd @1129 + SAM_change_key_entry_2K3DES_AV2_plain_one_key_Hnd @1130 + SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key @1131 + SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_keyM @1132 + SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key @1133 + SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_keyM @1134 + SAM_change_key_entry_3K3DES_AV2_plain_one_key @1135 + SAM_change_key_entry_3K3DES_AV2_plain_one_keyM @1136 + SAM_change_key_entry_3K3DES_AV2_plain_one_key_Hnd @1137 + SAM_change_key_entry_AES_AV2_plain_one_key @1138 + SAM_change_key_entry_AES_AV2_plain_one_keyM @1139 + SAM_change_key_entry_DES_AV2_plain_one_key @1140 + SAM_change_key_entry_DES_AV2_plain_one_key_Hnd @1141 + SAM_change_key_entry_aes_AV2_plain_host_key @1142 + SAM_change_key_entry_aes_AV2_plain_host_keyM @1143 + SAM_change_key_entry_aes_AV2_plain_host_key_Hnd @1144 + SAM_change_key_entry_aes_AV2_plain_one_key_Hnd @1145 + SAM_change_key_entry_mifare_AV2_plain_one_key @1146 + SAM_change_key_entry_mifare_AV2_plain_one_keyM @1147 + SAM_change_key_entry_mifare_AV2_plain_one_key_Hnd @1148 + SAM_get_key_entry_raw @1149 + SAM_get_key_entry_rawM @1150 + SAM_get_key_entry_raw_hnd @1151 + SAM_get_version @1152 + SAM_get_versionM @1153 + SAM_get_version_Hnd @1154 + SAM_get_version_raw @1155 + SAM_get_version_rawM @1156 + SAM_get_version_raw_Hnd @1157 + SAM_pre_personalization_switch_to_AV2_mode @1158 + SAM_pre_personalization_switch_to_AV2_modeM @1159 + SAM_pre_personalization_switch_to_AV2_mode_Hnd @1160 + SAM_pre_pesonalization_master_AES128_key @1161 + SAM_pre_pesonalization_master_AES128_keyM @1162 + SAM_pre_pesonalization_master_AES128_key_Hnd @1163 + SSL_CTX_check_private_key @1164 + SSL_CTX_free @1165 + SSL_CTX_new @1166 + SSL_CTX_root_ca @1167 + SSL_CTX_set_verify @1168 + SSL_CTX_use_PrivateKey_file @1169 + SSL_CTX_use_certificate_file @1170 + SSL_accept @1171 + SSL_connect @1172 + SSL_free @1173 + SSL_get_error @1174 + SSL_library_init @1175 + SSL_load_error_strings @1176 + SSL_pending @1177 + SSL_read @1178 + SSL_set_fd @1179 + SSL_set_io @1180 + SSL_set_userdata @1181 + SSL_shutdown @1182 + SSL_userdata @1183 + SSL_write @1184 + SSLv3_client_method @1185 + SSLv3_server_method @1186 + SectorTrailerWrite @1187 + SectorTrailerWriteHnd @1188 + SectorTrailerWriteM @1189 + SectorTrailerWriteSamKey @1190 + SectorTrailerWriteSamKeyHnd @1191 + SectorTrailerWriteSamKeyM @1192 + SectorTrailerWriteUnsafe @1193 + SectorTrailerWriteUnsafeHnd @1194 + SectorTrailerWriteUnsafeM @1195 + SectorTrailerWriteUnsafe_AKM1 @1196 + SectorTrailerWriteUnsafe_AKM1Hnd @1197 + SectorTrailerWriteUnsafe_AKM1M @1198 + SectorTrailerWriteUnsafe_AKM2 @1199 + SectorTrailerWriteUnsafe_AKM2Hnd @1200 + SectorTrailerWriteUnsafe_AKM2M @1201 + SectorTrailerWriteUnsafe_PK @1202 + SectorTrailerWriteUnsafe_PKHnd @1203 + SectorTrailerWriteUnsafe_PKM @1204 + SectorTrailerWrite_AKM1 @1205 + SectorTrailerWrite_AKM1Hnd @1206 + SectorTrailerWrite_AKM1M @1207 + SectorTrailerWrite_AKM2 @1208 + SectorTrailerWrite_AKM2Hnd @1209 + SectorTrailerWrite_AKM2M @1210 + SectorTrailerWrite_PK @1211 + SectorTrailerWrite_PKHnd @1212 + SectorTrailerWrite_PKM @1213 + SelectCard @1214 + SelectCardHnd @1215 + SelectCardM @1216 + SetATECC608DefaultKeysConfiguration @1217 + SetATECC608DefaultKeysConfigurationHnd @1218 + SetATECC608DefaultKeysConfigurationM @1219 + SetATECC608DefaultSlotsConfiguration @1220 + SetATECC608DefaultSlotsConfigurationHnd @1221 + SetATECC608DefaultSlotsConfigurationM @1222 + SetATECC608ECCPrivateKey @1223 + SetATECC608ECCPrivateKeyHnd @1224 + SetATECC608ECCPrivateKeyM @1225 + SetATECC608ECCPrivateKeyUnencrypted @1226 + SetATECC608ECCPrivateKeyUnencryptedHnd @1227 + SetATECC608ECCPrivateKeyUnencryptedM @1228 + SetATECC608Hnd @1229 + SetATECC608IOSecretKey @1230 + SetATECC608IOSecretKeyHnd @1231 + SetATECC608IOSecretKeyM @1232 + SetAdHocEmulationParams @1233 + SetAdHocEmulationParamsHnd @1234 + SetAdHocEmulationParamsM @1235 + SetAsyncCardIdSendConfig @1236 + SetAsyncCardIdSendConfigEx @1237 + SetAsyncCardIdSendConfigExHnd @1238 + SetAsyncCardIdSendConfigExM @1239 + SetAsyncCardIdSendConfigHnd @1240 + SetAsyncCardIdSendConfigM @1241 + SetCustomUiConfig @1242 + SetCustomUiConfigHnd @1243 + SetCustomUiConfigM @1244 + SetDefaultUartSpeed @1245 + SetDiscoveryLoop @1246 + SetDiscoveryLoopHnd @1247 + SetDiscoveryLoopM @1248 + SetDisplayData @1249 + SetDisplayDataHnd @1250 + SetDisplayDataM @1251 + SetDisplayIntensity @1252 + SetDisplayIntensityHnd @1253 + SetDisplayIntensityM @1254 + SetFeaturesHnd @1255 + SetISO14443_4_DLStorage @1256 + SetISO14443_4_DLStorageHnd @1257 + SetISO14443_4_DLStorageM @1258 + SetISO14443_4_Mode @1259 + SetISO14443_4_ModeHnd @1260 + SetISO14443_4_ModeM @1261 + SetISO14443_4_Mode_GetATS @1262 + SetISO14443_4_Mode_GetATSHnd @1263 + SetISO14443_4_Mode_GetATSM @1264 + SetLicenseData @1265 + SetMobileUniqueIdAid @1266 + SetMobileUniqueIdAidHnd @1267 + SetMobileUniqueIdAidM @1268 + SetReaderProMode @1269 + SetReaderProModeHnd @1270 + SetReaderProModeM @1271 + SetReaderSerialDescription @1272 + SetReaderSerialDescriptionHnd @1273 + SetReaderSerialDescriptionM @1274 + SetReaderTime @1275 + SetReaderTimeHnd @1276 + SetReaderTimeM @1277 + SetRfAnalogRegistersISO14443_212 @1278 + SetRfAnalogRegistersISO14443_212Default @1279 + SetRfAnalogRegistersISO14443_212DefaultHnd @1280 + SetRfAnalogRegistersISO14443_212DefaultM @1281 + SetRfAnalogRegistersISO14443_212Hnd @1282 + SetRfAnalogRegistersISO14443_212M @1283 + SetRfAnalogRegistersISO14443_424 @1284 + SetRfAnalogRegistersISO14443_424Default @1285 + SetRfAnalogRegistersISO14443_424DefaultHnd @1286 + SetRfAnalogRegistersISO14443_424DefaultM @1287 + SetRfAnalogRegistersISO14443_424Hnd @1288 + SetRfAnalogRegistersISO14443_424M @1289 + SetRfAnalogRegistersTypeA @1290 + SetRfAnalogRegistersTypeADefault @1291 + SetRfAnalogRegistersTypeADefaultHnd @1292 + SetRfAnalogRegistersTypeADefaultM @1293 + SetRfAnalogRegistersTypeAHnd @1294 + SetRfAnalogRegistersTypeAM @1295 + SetRfAnalogRegistersTypeATrans @1296 + SetRfAnalogRegistersTypeATransHnd @1297 + SetRfAnalogRegistersTypeATransM @1298 + SetRfAnalogRegistersTypeB @1299 + SetRfAnalogRegistersTypeBDefault @1300 + SetRfAnalogRegistersTypeBDefaultHnd @1301 + SetRfAnalogRegistersTypeBDefaultM @1302 + SetRfAnalogRegistersTypeBHnd @1303 + SetRfAnalogRegistersTypeBM @1304 + SetRfAnalogRegistersTypeBTrans @1305 + SetRfAnalogRegistersTypeBTransHnd @1306 + SetRfAnalogRegistersTypeBTransM @1307 + SetRgbData @1308 + SetRgbDataM @1309 + SetRgbIntensity @1310 + SetRgbIntensityM @1311 + SetServiceData @1312 + SetServiceDataHnd @1313 + SetServiceDataM @1314 + SetSpeakerFrequency @1315 + SetSpeakerFrequencyHnd @1316 + SetSpeakerFrequencyM @1317 + SetSpeedPermanently @1318 + SetSpeedPermanentlyHnd @1319 + SetSpeedPermanentlyM @1320 + SetUartDefaultSpeedHnd @1321 + SetUartSpeed @1322 + SetUartSpeedHnd @1323 + StartAsyncSession @1324 + StopAsyncSession @1325 + SubscribeBlock @1326 + SubscribeBlockHnd @1327 + SubscribeSector @1328 + SubscribeSectorHnd @1329 + TLS_Sign_NFC_GIDS @1330 + TOOM_MUL_CUTOFF @1331 DATA + TOOM_SQR_CUTOFF @1332 DATA + TagEmulationMirrorCounterDisabled @1333 + TagEmulationMirrorCounterNonResetEnabled @1334 + TagEmulationMirrorCounterResetEnabled @1335 + TagEmulationStart @1336 + TagEmulationStartHnd @1337 + TagEmulationStartM @1338 + TagEmulationStartRam @1339 + TagEmulationStop @1340 + TagEmulationStopHnd @1341 + TagEmulationStopM @1342 + TagEmulationStopRam @1343 + TestAuthMode @1344 + TestChecksum @1345 + TimerStart @1346 + TimerStop @1347 + UFR_DLCardType2String @1348 + UFR_SessionStatus2String @1349 + UFR_Status2String @1350 + ULC_ExtAuthRead_PKHnd @1351 + ULC_ExtAuthWrite_PKHnd @1352 + ULC_ExternalAuth_PK @1353 + ULC_ExternalAuth_PKHnd @1354 + ULC_ExternalAuth_PKM @1355 + ULC_write_3des_key @1356 + ULC_write_3des_keyHND @1357 + ULC_write_3des_keyM @1358 + ULC_write_3des_key_factory_key @1359 + ULC_write_3des_key_factory_keyM @1360 + ULC_write_3des_key_factory_key_internal @1361 + ULC_write_3des_key_factory_key_internalM @1362 + ULC_write_3des_key_internal @1363 + ULC_write_3des_key_internalHND @1364 + ULC_write_3des_key_internalM @1365 + ULC_write_3des_key_no_auth @1366 + ULC_write_3des_key_no_authM @1367 + ULC_write_3des_key_no_auth_internal @1368 + ULC_write_3des_key_no_auth_internalM @1369 + UfrEnterSleepMode @1370 + UfrEnterSleepModeHnd @1371 + UfrEnterSleepModeM @1372 + UfrGetBadSelectCardNrMax @1373 + UfrGetBadSelectCardNrMaxM @1374 + UfrGetBadSelectNrHnd @1375 + UfrGetInputState @1376 + UfrLeaveSleepMode @1377 + UfrLeaveSleepModeHnd @1378 + UfrLeaveSleepModeM @1379 + UfrOutControl @1380 + UfrOutControlHnd @1381 + UfrOutControlM @1382 + UfrRedLightControl @1383 + UfrRedLightControlHnd @1384 + UfrRedLightControlM @1385 + UfrRgbExtLightControl @1386 + UfrRgbExtLightControlHnd @1387 + UfrRgbExtLightControlM @1388 + UfrRgbLightControl @1389 + UfrRgbLightControlHnd @1390 + UfrRgbLightControlM @1391 + UfrRgbLightControlRfHnd @1392 + UfrRgbLightControlRfPeriod @1393 + UfrRgbLightControlRfPeriodM @1394 + UfrRgbLightControlSleep @1395 + UfrRgbLightControlSleepHnd @1396 + UfrRgbLightControlSleepM @1397 + UfrSetBadSelectCardNrMax @1398 + UfrSetBadSelectCardNrMaxM @1399 + UfrSetBadSelectNrHnd @1400 + UfrXrcGetInputStateHnd @1401 + UfrXrcGetIoState @1402 + UfrXrcGetIoStateHnd @1403 + UfrXrcGetIoStateM @1404 + UfrXrcLockOn @1405 + UfrXrcLockOnHnd @1406 + UfrXrcLockOnM @1407 + UfrXrcRelayState @1408 + UfrXrcRelayStateHnd @1409 + UfrXrcRelayStateM @1410 + UnloadFTD2XXLibrary @1411 + ValidateCheckDigit @1412 + ValueBlockDecrement @1413 + ValueBlockDecrementHnd @1414 + ValueBlockDecrementM @1415 + ValueBlockDecrementSamKey @1416 + ValueBlockDecrementSamKeyHnd @1417 + ValueBlockDecrementSamKeyM @1418 + ValueBlockDecrement_AKM1 @1419 + ValueBlockDecrement_AKM1Hnd @1420 + ValueBlockDecrement_AKM1M @1421 + ValueBlockDecrement_AKM2 @1422 + ValueBlockDecrement_AKM2Hnd @1423 + ValueBlockDecrement_AKM2M @1424 + ValueBlockDecrement_PK @1425 + ValueBlockDecrement_PKHnd @1426 + ValueBlockDecrement_PKM @1427 + ValueBlockInSectorDecrement @1428 + ValueBlockInSectorDecrementHnd @1429 + ValueBlockInSectorDecrementM @1430 + ValueBlockInSectorDecrementSamKey @1431 + ValueBlockInSectorDecrementSamKeyHnd @1432 + ValueBlockInSectorDecrementSamKeyM @1433 + ValueBlockInSectorDecrement_AKM1 @1434 + ValueBlockInSectorDecrement_AKM1Hnd @1435 + ValueBlockInSectorDecrement_AKM1M @1436 + ValueBlockInSectorDecrement_AKM2 @1437 + ValueBlockInSectorDecrement_AKM2Hnd @1438 + ValueBlockInSectorDecrement_AKM2M @1439 + ValueBlockInSectorDecrement_PK @1440 + ValueBlockInSectorDecrement_PKHnd @1441 + ValueBlockInSectorDecrement_PKM @1442 + ValueBlockInSectorIncrement @1443 + ValueBlockInSectorIncrementHnd @1444 + ValueBlockInSectorIncrementM @1445 + ValueBlockInSectorIncrementSamKey @1446 + ValueBlockInSectorIncrementSamKeyHnd @1447 + ValueBlockInSectorIncrementSamKeyM @1448 + ValueBlockInSectorIncrement_AKM1 @1449 + ValueBlockInSectorIncrement_AKM1Hnd @1450 + ValueBlockInSectorIncrement_AKM1M @1451 + ValueBlockInSectorIncrement_AKM2 @1452 + ValueBlockInSectorIncrement_AKM2Hnd @1453 + ValueBlockInSectorIncrement_AKM2M @1454 + ValueBlockInSectorIncrement_PK @1455 + ValueBlockInSectorIncrement_PKHnd @1456 + ValueBlockInSectorIncrement_PKM @1457 + ValueBlockInSectorRead @1458 + ValueBlockInSectorReadHnd @1459 + ValueBlockInSectorReadM @1460 + ValueBlockInSectorReadSamKey @1461 + ValueBlockInSectorReadSamKeyHnd @1462 + ValueBlockInSectorReadSamKeyM @1463 + ValueBlockInSectorRead_AKM1 @1464 + ValueBlockInSectorRead_AKM1Hnd @1465 + ValueBlockInSectorRead_AKM1M @1466 + ValueBlockInSectorRead_AKM2 @1467 + ValueBlockInSectorRead_AKM2Hnd @1468 + ValueBlockInSectorRead_AKM2M @1469 + ValueBlockInSectorRead_PK @1470 + ValueBlockInSectorRead_PKHnd @1471 + ValueBlockInSectorRead_PKM @1472 + ValueBlockInSectorWrite @1473 + ValueBlockInSectorWriteHnd @1474 + ValueBlockInSectorWriteM @1475 + ValueBlockInSectorWriteSamKey @1476 + ValueBlockInSectorWriteSamKeyHnd @1477 + ValueBlockInSectorWriteSamKeyM @1478 + ValueBlockInSectorWrite_AKM1 @1479 + ValueBlockInSectorWrite_AKM1Hnd @1480 + ValueBlockInSectorWrite_AKM1M @1481 + ValueBlockInSectorWrite_AKM2 @1482 + ValueBlockInSectorWrite_AKM2Hnd @1483 + ValueBlockInSectorWrite_AKM2M @1484 + ValueBlockInSectorWrite_PK @1485 + ValueBlockInSectorWrite_PKHnd @1486 + ValueBlockInSectorWrite_PKM @1487 + ValueBlockIncrement @1488 + ValueBlockIncrementHnd @1489 + ValueBlockIncrementM @1490 + ValueBlockIncrementSamKey @1491 + ValueBlockIncrementSamKeyHnd @1492 + ValueBlockIncrementSamKeyM @1493 + ValueBlockIncrement_AKM1 @1494 + ValueBlockIncrement_AKM1Hnd @1495 + ValueBlockIncrement_AKM1M @1496 + ValueBlockIncrement_AKM2 @1497 + ValueBlockIncrement_AKM2Hnd @1498 + ValueBlockIncrement_AKM2M @1499 + ValueBlockIncrement_PK @1500 + ValueBlockIncrement_PKHnd @1501 + ValueBlockIncrement_PKM @1502 + ValueBlockRead @1503 + ValueBlockReadHnd @1504 + ValueBlockReadM @1505 + ValueBlockReadSamKey @1506 + ValueBlockReadSamKeyHnd @1507 + ValueBlockReadSamKeyM @1508 + ValueBlockRead_AKM1 @1509 + ValueBlockRead_AKM1Hnd @1510 + ValueBlockRead_AKM1M @1511 + ValueBlockRead_AKM2 @1512 + ValueBlockRead_AKM2Hnd @1513 + ValueBlockRead_AKM2M @1514 + ValueBlockRead_PK @1515 + ValueBlockRead_PKHnd @1516 + ValueBlockRead_PKM @1517 + ValueBlockWrite @1518 + ValueBlockWriteHnd @1519 + ValueBlockWriteM @1520 + ValueBlockWriteSamKey @1521 + ValueBlockWriteSamKeyHnd @1522 + ValueBlockWriteSamKeyM @1523 + ValueBlockWrite_AKM1 @1524 + ValueBlockWrite_AKM1Hnd @1525 + ValueBlockWrite_AKM1M @1526 + ValueBlockWrite_AKM2 @1527 + ValueBlockWrite_AKM2Hnd @1528 + ValueBlockWrite_AKM2M @1529 + ValueBlockWrite_PK @1530 + ValueBlockWrite_PKHnd @1531 + ValueBlockWrite_PKM @1532 + WriteEmulationNdef @1533 + WriteEmulationNdefHnd @1534 + WriteEmulationNdefM @1535 + WriteEmulationNdefRam @1536 + WriteEmulationNdefRamM @1537 + WriteEmulationNdefWithAAR @1538 + WriteEmulationNdefWithAARHnd @1539 + WriteNdefRecord_Address @1540 + WriteNdefRecord_AddressHnd @1541 + WriteNdefRecord_AddressM @1542 + WriteNdefRecord_AndroidApp @1543 + WriteNdefRecord_AndroidAppHnd @1544 + WriteNdefRecord_AndroidAppM @1545 + WriteNdefRecord_BT @1546 + WriteNdefRecord_BTHnd @1547 + WriteNdefRecord_BTM @1548 + WriteNdefRecord_Bitcoin @1549 + WriteNdefRecord_BitcoinHnd @1550 + WriteNdefRecord_BitcoinM @1551 + WriteNdefRecord_Contact @1552 + WriteNdefRecord_ContactHnd @1553 + WriteNdefRecord_ContactM @1554 + WriteNdefRecord_Email @1555 + WriteNdefRecord_EmailHnd @1556 + WriteNdefRecord_EmailM @1557 + WriteNdefRecord_GeoLocation @1558 + WriteNdefRecord_GeoLocationHnd @1559 + WriteNdefRecord_GeoLocationM @1560 + WriteNdefRecord_NaviDestination @1561 + WriteNdefRecord_NaviDestinationHnd @1562 + WriteNdefRecord_NaviDestinationM @1563 + WriteNdefRecord_Phone @1564 + WriteNdefRecord_PhoneHnd @1565 + WriteNdefRecord_PhoneM @1566 + WriteNdefRecord_SMS @1567 + WriteNdefRecord_SMSHnd @1568 + WriteNdefRecord_SMSM @1569 + WriteNdefRecord_Skype @1570 + WriteNdefRecord_SkypeHnd @1571 + WriteNdefRecord_SkypeM @1572 + WriteNdefRecord_StreetView @1573 + WriteNdefRecord_StreetViewHnd @1574 + WriteNdefRecord_StreetViewM @1575 + WriteNdefRecord_Text @1576 + WriteNdefRecord_TextHnd @1577 + WriteNdefRecord_TextM @1578 + WriteNdefRecord_Viber @1579 + WriteNdefRecord_ViberHnd @1580 + WriteNdefRecord_ViberM @1581 + WriteNdefRecord_Whatsapp @1582 + WriteNdefRecord_WhatsappHnd @1583 + WriteNdefRecord_WhatsappM @1584 + WriteNdefRecord_WiFi @1585 + WriteNdefRecord_WiFiHnd @1586 + WriteNdefRecord_WiFiM @1587 + WriteReaderId @1588 + WriteReaderIdHnd @1589 + WriteReaderIdM @1590 + WriteSamUnlockKey @1591 + WriteSamUnlockKeyHnd @1592 + WriteSamUnlockKeyM @1593 + WriteShareRam @1594 + WriteShareRamHnd @1595 + WriteShareRamM @1596 + WriteUserData @1597 + WriteUserDataExt @1598 + WriteUserDataExtM @1599 + WriteUserDataHnd @1600 + WriteUserDataM @1601 + X509GetAKIFromCert @1602 + X509GetAKIFromExtension @1603 + X509GetCertFromFile @1604 + X509GetExtension @1605 + X509GetExtensionsPos @1606 + X509GetExtensionsSeq @1607 + X509GetIssuerPos @1608 + X509GetIssuerSeq @1609 + X509GetPublicKeyInfoPos @1610 + X509GetRSAPubKeyExponent @1611 + X509GetSKIFromCert @1612 + X509GetSKIFromExtension @1613 + X509GetSerialNumberByteArr @1614 + X509GetSerialNumberPos @1615 + X509GetSerialNumberSeq @1616 + X509GetSignature @1617 + X509GetSignatureAlgFromTBSPos @1618 + X509GetSignatureAlgorithm @1619 + X509GetSignatureAlgorithmNodePos @1620 + X509GetSubjectPos @1621 + X509GetSubjectSeq @1622 + X509GetTbs @1623 + X509GetTbsNodePos @1624 + X509GetValidityPeriodPos @1625 + X509GetValidityPeriodSeq @1626 + X509GetVersion @1627 + X509ParsePubKey @1628 + X509VerifyDerCertSignature @1629 + XRC_ReceiveAnswerBoot @1630 + XRC_SendCommand @1631 + __emutls_get_address @1632 + __emutls_register_common @1633 + _dist_code @1634 DATA + _hnd_ufr @1635 DATA + _isBigEndian @1636 + _is_field @1637 + _is_oid @1638 + _is_oid2 @1639 + _length_code @1640 DATA + _private_asn1_parse @1641 + _private_b64_decode @1642 + _private_b64_decodeblock @1643 + _private_dtls_handshake_copyframesize @1644 + _private_dtls_handshake_data @1645 + _private_is_oid @1646 + _private_random_sleep @1647 + _private_tls_build_random @1648 + _private_tls_compute_hash @1649 + _private_tls_compute_key @1650 + _private_tls_create_hash @1651 + _private_tls_crypto_create @1652 + _private_tls_crypto_decrypt @1653 + _private_tls_crypto_done @1654 + _private_tls_crypto_encrypt @1655 + _private_tls_decrypt_dhe @1656 + _private_tls_decrypt_ecc_dhe @1657 + _private_tls_decrypt_rsa @1658 + _private_tls_destroy_hash @1659 + _private_tls_dh_clear_key @1660 + _private_tls_dh_export_Y @1661 + _private_tls_dh_export_pqY @1662 + _private_tls_dh_make_key @1663 + _private_tls_dh_shared_secret @1664 + _private_tls_dhe_create @1665 + _private_tls_dhe_free @1666 + _private_tls_done_hash @1667 + _private_tls_ecc_dhe_create @1668 + _private_tls_ecc_dhe_free @1669 + _private_tls_encrypt_rsa @1670 + _private_tls_ensure_hash @1671 + _private_tls_expand_key @1672 + _private_tls_get_hash @1673 + _private_tls_get_hash_idx @1674 + _private_tls_hash_len @1675 + _private_tls_hmac_message @1676 + _private_tls_is_aead @1677 + _private_tls_key_length @1678 + _private_tls_mac_length @1679 + _private_tls_parse_dh @1680 + _private_tls_parse_random @1681 + _private_tls_parse_signature @1682 + _private_tls_prf @1683 + _private_tls_prf_helper @1684 + _private_tls_random_int @1685 + _private_tls_read_from_file @1686 + _private_tls_reset_context @1687 + _private_tls_safe_read @1688 + _private_tls_set_session_id @1689 + _private_tls_sign_rsa @1690 + _private_tls_sleep @1691 + _private_tls_update_hash @1692 + _private_tls_verify_rsa @1693 + _private_tls_write_app_data @1694 + _private_tls_write_packet @1695 + _shadow_DES_check_key @1696 DATA + _tls_ssl_private_send_pending @1697 + _tr_align @1698 + _tr_flush_bits @1699 + _tr_flush_block @1700 + _tr_init @1701 + _tr_stored_block @1702 + _tr_tally @1703 + accList_allocate @1704 + adler32 @1705 + adler32_combine @1706 + adler32_combine64 @1707 + adler32_z @1708 + aes_desc @1709 DATA + ais_erase_right_record @1710 + ais_erase_right_recordHnd @1711 + ais_erase_right_recordM @1712 + ais_get_card_daily_duration @1713 + ais_get_card_daily_durationHnd @1714 + ais_get_card_daily_durationM @1715 + ais_get_card_number @1716 + ais_get_card_numberHnd @1717 + ais_get_card_numberM @1718 + ais_get_card_total_duration @1719 + ais_get_card_total_durationHnd @1720 + ais_get_card_total_durationM @1721 + ais_get_card_type @1722 + ais_get_card_typeHnd @1723 + ais_get_card_typeM @1724 + ais_get_credit_and_period_validity @1725 + ais_get_credit_and_period_validityHnd @1726 + ais_get_credit_and_period_validityM @1727 + ais_get_right_record @1728 + ais_get_right_recordHnd @1729 + ais_get_right_recordM @1730 + ais_get_right_record_type_max_daily_counter @1731 + ais_get_right_record_type_max_daily_counterHnd @1732 + ais_get_right_record_type_max_daily_counterM @1733 + ais_get_right_type_record @1734 + ais_get_right_type_recordHnd @1735 + ais_get_right_type_recordM @1736 + ais_get_validate_record @1737 + ais_get_validate_recordHnd @1738 + ais_get_validate_recordM @1739 + ais_set_card_daily_duration @1740 + ais_set_card_daily_durationHnd @1741 + ais_set_card_daily_durationM @1742 + ais_set_card_total_duration @1743 + ais_set_card_total_durationHnd @1744 + ais_set_card_total_durationM @1745 + ais_set_card_type @1746 + ais_set_card_typeHnd @1747 + ais_set_card_typeM @1748 + ais_set_credit_and_period_validity @1749 + ais_set_credit_and_period_validityHnd @1750 + ais_set_credit_and_period_validityM @1751 + ais_set_right_record @1752 + ais_set_right_recordHnd @1753 + ais_set_right_recordM @1754 + ais_set_right_record_type_max_daily_counter @1755 + ais_set_right_record_type_max_daily_counterHnd @1756 + ais_set_right_record_type_max_daily_counterM @1757 + ais_set_right_type_record @1758 + ais_set_right_type_recordHnd @1759 + ais_set_right_type_recordM @1760 + ais_set_validate_record @1761 + ais_set_validate_recordHnd @1762 + ais_set_validate_recordM @1763 + appendToEnd @1764 + ascii_to_hex @1765 + asn1_get_len @1766 + asn1_parse @1767 + assert_crypto_buffer_size @1768 + asyncUIDThread @1769 + balance_get_creditHnd @1770 + balance_set_creditHnd @1771 + base64_decode @1772 + base64_sane_decode @1773 + base64_strict_decode @1774 + bin_bcd_to_i @1775 + bin_bcd_to_ll @1776 + bn_reverse @1777 + bp @1778 + buffer_to_hex_string @1779 + bytes_to_string @1780 + cardDetectedCallback @1781 DATA + cardRemovedCallback @1782 DATA + card_halt_enable @1783 + card_halt_enableHnd @1784 + card_halt_enableM @1785 + card_transceive @1786 + card_transceiveM @1787 + card_transceive_mode_start @1788 + card_transceive_mode_startM @1789 + card_transceive_mode_stop @1790 + card_transceive_mode_stopM @1791 + cbc_decrypt @1792 + cbc_done @1793 + cbc_encrypt @1794 + cbc_start @1795 + cert_len @1796 DATA + checkRSAKeySize @1797 + check_clear_record_transaction_mac @1798 + check_credit_value_transaction_mac @1799 + check_debit_value_transaction_mac @1800 + check_sdm_mac @1801 + check_write_record_transaction_mac @1802 + cipher_descriptor @1803 DATA + cipher_is_valid @1804 + classic_ev1_publickey_str @1805 DATA + clear_internal_keys @1806 + close_ISO7816_interface_APDU_ISO14443_4 @1807 + close_ISO7816_interface_APDU_ISO14443_4Hnd @1808 + close_ISO7816_interface_APDU_ISO14443_4M @1809 + close_ISO7816_interface_no_APDU @1810 + close_ISO7816_interface_no_APDUHnd @1811 + close_ISO7816_interface_no_APDUM @1812 + cmac @1813 + cmac_generate_subkeys @1814 + cmpfunc @1815 + compress @1816 + compress2 @1817 + compressBound @1818 + crc32 @1819 + crc32_combine @1820 + crc32_combine64 @1821 + crc32_z @1822 + crypt_argchk @1823 + debug @1824 DATA + decompress @1825 + decrypt_picc_data @1826 + decrypt_sdm_enc_file_data @1827 + deflate @1828 + deflateBound @1829 + deflateCopy @1830 + deflateEnd @1831 + deflateGetDictionary @1832 + deflateInit2_ @1833 + deflateInit_ @1834 + deflateParams @1835 + deflatePending @1836 + deflatePrime @1837 + deflateReset @1838 + deflateResetKeep @1839 + deflateSetDictionary @1840 + deflateSetHeader @1841 + deflateTune @1842 + deflate_copyright @1843 DATA + der_asn1_class_to_string_map @1844 DATA + der_asn1_class_to_string_map_sz @1845 DATA + der_asn1_pc_to_string_map @1846 DATA + der_asn1_pc_to_string_map_sz @1847 DATA + der_asn1_tag_to_string_map @1848 DATA + der_asn1_tag_to_string_map_sz @1849 DATA + der_asn1_tag_to_type_map @1850 DATA + der_asn1_tag_to_type_map_sz @1851 DATA + der_asn1_type_to_identifier_map @1852 DATA + der_asn1_type_to_identifier_map_sz @1853 DATA + der_decode_asn1_identifier @1854 + der_decode_asn1_length @1855 + der_decode_bit_string @1856 + der_decode_boolean @1857 + der_decode_choice @1858 + der_decode_custom_type @1859 + der_decode_custom_type_ex @1860 + der_decode_generalizedtime @1861 + der_decode_ia5_string @1862 + der_decode_integer @1863 + der_decode_object_identifier @1864 + der_decode_octet_string @1865 + der_decode_printable_string @1866 + der_decode_raw_bit_string @1867 + der_decode_sequence_ex @1868 + der_decode_sequence_flexi @1869 + der_decode_sequence_multi @1870 + der_decode_sequence_multi_ex @1871 + der_decode_short_integer @1872 + der_decode_teletex_string @1873 + der_decode_utctime @1874 + der_decode_utf8_string @1875 + der_encode_asn1_identifier @1876 + der_encode_asn1_length @1877 + der_encode_bit_string @1878 + der_encode_boolean @1879 + der_encode_custom_type @1880 + der_encode_generalizedtime @1881 + der_encode_ia5_string @1882 + der_encode_integer @1883 + der_encode_object_identifier @1884 + der_encode_octet_string @1885 + der_encode_printable_string @1886 + der_encode_raw_bit_string @1887 + der_encode_sequence_ex @1888 + der_encode_set @1889 + der_encode_setof @1890 + der_encode_short_integer @1891 + der_encode_utctime @1892 + der_encode_utf8_string @1893 + der_ia5_char_encode @1894 + der_ia5_value_decode @1895 + der_length_asn1_identifier @1896 + der_length_asn1_length @1897 + der_length_bit_string @1898 + der_length_boolean @1899 + der_length_custom_type @1900 + der_length_generalizedtime @1901 + der_length_ia5_string @1902 + der_length_integer @1903 + der_length_object_identifier @1904 + der_length_octet_string @1905 + der_length_printable_string @1906 + der_length_sequence @1907 + der_length_sequence_ex @1908 + der_length_short_integer @1909 + der_length_teletex_string @1910 + der_length_utctime @1911 + der_length_utf8_string @1912 + der_object_identifier_bits @1913 + der_printable_char_encode @1914 + der_printable_value_decode @1915 + der_sequence_free @1916 + der_teletex_char_encode @1917 + der_teletex_value_decode @1918 + der_utf8_charsize @1919 + der_utf8_valid_char @1920 + des3_desc @1921 DATA + des3_done @1922 + des3_ecb_decrypt @1923 + des3_ecb_encrypt @1924 + des3_keysize @1925 + des3_setup @1926 + des3_test @1927 + des_desc @1928 DATA + des_done @1929 + des_ecb_decrypt @1930 + des_ecb_encrypt @1931 + des_keysize @1932 + des_setup @1933 + des_test @1934 + desfire_check_clear_record_transaction_mac @1935 + desfire_check_write_record_transaction_mac @1936 + desfire_crc32 @1937 + desfire_crc32_append @1938 + desfire_ev2_publickey_str @1939 DATA + desfire_light_publickey_str @1940 DATA + dev_type @1941 DATA + dfl_change_file_settings @1942 + dfl_change_file_settingsM @1943 + dfl_change_file_settings_pk @1944 + dfl_change_file_settings_pkM @1945 + dfl_change_tmc_file_settings @1946 + dfl_change_tmc_file_settingsM @1947 + dfl_change_tmc_file_settings_pk @1948 + dfl_change_tmc_file_settings_pkM @1949 + dfl_check_credit_value_transaction_mac @1950 + dfl_check_debit_value_transaction_mac @1951 + dfl_check_write_record_transaction_mac @1952 + dfl_delete_tmc_file @1953 + dfl_delete_tmc_fileM @1954 + dfl_delete_tmc_file_hnd @1955 + dfl_delete_tmc_file_pk @1956 + dfl_delete_tmc_file_pkM @1957 + dfl_get_file_settings @1958 + dfl_session_transaction_mac_enc_key @1959 + dfl_session_transaction_mac_mac_key @1960 + dg1_last_sha256 @1961 DATA + dg2_last_sha256 @1962 DATA + dl_key_type @1963 DATA + dl_new_key_type @1964 DATA + do_f_to_all_devices @1965 + dp @1966 + dp_hex @1967 + dp_hex_eol @1968 + dtls_reset_cookie_secret @1969 + ecc_ansi_x963_export @1970 + ecc_ansi_x963_import @1971 + ecc_ansi_x963_import_ex @1972 + ecc_copy_curve @1973 + ecc_curve_designators @1974 DATA + ecc_curve_names @1975 DATA + ecc_find_curve @1976 + ecc_free @1977 + ecc_generate_key @1978 + ecc_get_key @1979 + ecc_import @1980 + ecc_import_ex @1981 + ecc_import_subject_public_key_info @1982 + ecc_import_x509 @1983 + ecc_make_key @1984 + ecc_make_key_ex @1985 + ecc_set_curve @1986 + ecc_set_curve_by_size @1987 + ecc_set_curve_from_mpis @1988 + ecc_set_key @1989 + ecc_shared_secret @1990 + ecc_verify_hash_ex @1991 + emvAflListCleanup @1992 + emvReadRecord @1993 + emvTreeCleanup @1994 + emv_tags @1995 DATA + enciphered_data_length @1996 + endianness @1997 + erase_all_ndef_records @1998 + erase_all_ndef_recordsHnd @1999 + erase_all_ndef_recordsM @2000 + erase_last_ndef_record @2001 + erase_last_ndef_recordHnd @2002 + erase_last_ndef_recordM @2003 + error @2004 + error_to_string @2005 + exit_requested @2006 DATA + fast_mp_invmod @2007 + fast_mp_montgomery_reduce @2008 + fast_s_mp_mul_digs @2009 + fast_s_mp_mul_high_digs @2010 + fast_s_mp_sqr @2011 + findCountryIndexByNumCode @2012 + findCurrencyIndexByNumCode @2013 + findEMVTagValue @2014 + findEmvTagIndex @2015 + find_active_com_ports @2016 + find_cipher @2017 + find_hash @2018 + find_prng @2019 + formatGetProcessingOptionsDataField @2020 + found_device_info @2021 + frame_error_detected @2022 + fsizeof @2023 + ftdi_CheckRTS @2024 + ftdi_GetDriverVersion @2025 + ftdi_configure_hnd @2026 + ftdi_getDevNum @2027 + ftdi_getUfrDevices @2028 + ftdi_get_set_vid_pid @2029 + ftdi_multiReader_getUfrDevices @2030 + ftdi_open @2031 + ftdi_read @2032 + ftdi_write @2033 + gcm_add_aad @2034 + gcm_add_iv @2035 + gcm_done @2036 + gcm_gf_mult @2037 + gcm_init @2038 + gcm_mult_h @2039 + gcm_process @2040 + gcm_reset @2041 + getAfl @2042 + getAflFromResponseMessageTemplateFormat1 @2043 + getAid @2044 + getAid__ @2045 + getCardManufacturer @2046 + getHashByteSize @2047 + getHashName @2048 + getListLength @2049 + getLogEntry @2050 + getLogEntry__ @2051 + getPdol @2052 + getPicturePixelValue @2053 + getSfi @2054 + getTlvLen @2055 + get_ber_tlv_length @2056 + get_crc_table @2057 + get_local_net_addr @2058 + get_ndef_card_data @2059 + get_ndef_record_count @2060 + get_ndef_record_countHnd @2061 + get_ndef_record_countM @2062 + get_ns @2063 + getlocalip @2064 + glob_sig @2065 DATA + glob_sig_len @2066 DATA + globalCertificateType @2067 DATA + globalClientCertificate @2068 DATA + globalClientCertificateLen @2069 DATA + globalClientPrivateKey @2070 DATA + globalClientPrivateKeyLen @2071 DATA + globalPIN @2072 DATA + globalPINLen @2073 DATA + global_ble_context @2074 DATA + global_nfc_context @2075 DATA + gz_error @2076 + gzbuffer @2077 + gzclearerr @2078 + gzclose @2079 + gzclose_r @2080 + gzclose_w @2081 + gzdirect @2082 + gzdopen @2083 + gzeof @2084 + gzerror @2085 + gzflush @2086 + gzfread @2087 + gzfwrite @2088 + gzgetc @2089 + gzgetc_ @2090 + gzgets @2091 + gzoffset @2092 + gzoffset64 @2093 + gzopen @2094 + gzopen64 @2095 + gzopen_w @2096 + gzprintf @2097 + gzputc @2098 + gzputs @2099 + gzread @2100 + gzrewind @2101 + gzseek @2102 + gzseek64 @2103 + gzsetparams @2104 + gztell @2105 + gztell64 @2106 + gzungetc @2107 + gzvprintf @2108 + gzwrite @2109 + hash_algs_byte_sizes @2110 DATA + hash_algs_names @2111 DATA + hash_descriptor @2112 DATA + hash_is_valid @2113 + hash_memory @2114 + hex2bin @2115 + hex2str @2116 + hexsprintf @2117 + hmac_done @2118 + hmac_init @2119 + hmac_process @2120 + i_block_trans_rcv_chain @2121 + i_block_trans_rcv_chainM @2122 + i_block_transceiveHnd @2123 + i_block_transmitHnd @2124 + icaoMlClearSearchCriteria @2125 + icaoMlClose @2126 + icaoMlFindCert @2127 + icaoMlGetCurrentCertAndMoveToNext @2128 + icaoMlMoveToFirstCert @2129 + icaoMlOpen @2130 + icode_lock_block @2131 + icode_lock_blockM @2132 + icode_lock_block_PK @2133 + icode_lock_block_PK_M @2134 + icode_protect_page @2135 + icode_protect_pageM @2136 + icode_protect_page_PK @2137 + icode_protect_page_PK_M @2138 + icode_protect_page_hnd @2139 + icode_write_password @2140 + icode_write_passwordM @2141 + icode_write_password_PK @2142 + icode_write_password_PK_M @2143 + icode_write_password_hnd @2144 + image_base64_encode @2145 + inflate @2146 + inflateBack @2147 + inflateBackEnd @2148 + inflateBackInit_ @2149 + inflateCodesUsed @2150 + inflateCopy @2151 + inflateEnd @2152 + inflateGetDictionary @2153 + inflateGetHeader @2154 + inflateInit2_ @2155 + inflateInit_ @2156 + inflateMark @2157 + inflatePrime @2158 + inflateReset @2159 + inflateReset2 @2160 + inflateResetKeep @2161 + inflateSetDictionary @2162 + inflateSync @2163 + inflateSyncPoint @2164 + inflateUndermine @2165 + inflateValidate @2166 + inflate_copyright @2167 DATA + inflate_fast @2168 + inflate_table @2169 + initCryptoSubsys @2170 + isByteArrayPrintable @2171 + isCryptoSubsysInitialized @2172 + isExistATCounter @2173 + isExistAmountAuthorised @2174 + isExistTerminalCountry @2175 + isExistTransactionCurrency @2176 + isExistTransactionDate @2177 + isExistTransactionTime @2178 + isFilePath @2179 + isFtdiCOMPort @2180 + isSignatureSchType_ECDSA @2181 + isSignatureSchType_RSA_PKCS1 @2182 + isSignatureSchType_RSA_PSS @2183 + is_array_numeric @2184 + is_init @2185 DATA + iso14443_cascade_uid @2186 + iso14443a_crc @2187 + iso14443a_crc_append @2188 + iso14443a_locate_historical_bytes @2189 + iso14443b_crc @2190 + iso14443b_crc_append @2191 + iso15693_get_multiply_block_security_status @2192 + iso15693_get_multiply_block_security_statusM @2193 + iso15693_get_multiply_block_security_status_hnd @2194 + iso15693_lock_block_hnd @2195 + iso15693_lock_block_no_auth @2196 + iso15693_lock_block_no_authM @2197 + iso3166_country_codes @2198 DATA + iso4217_currency_codes @2199 DATA + jc_type @2200 DATA + key_block_size @2201 + key_version @2202 DATA + len_pub_key_ab @2203 DATA + len_pub_key_field @2204 DATA + len_pub_key_g @2205 DATA + len_pub_key_modulus @2206 DATA + len_pub_key_r @2207 DATA + list_add @2208 + list_get_by_idx @2209 + list_multi_remove @2210 + list_remove @2211 + list_size @2212 + lsl @2213 + ltc_cleanup_multi @2214 + ltc_deinit_multi @2215 + ltc_ecc_copy_point @2216 + ltc_ecc_curves @2217 DATA + ltc_ecc_del_point @2218 + ltc_ecc_export_point @2219 + ltc_ecc_import_point @2220 + ltc_ecc_is_point @2221 + ltc_ecc_is_point_at_infinity @2222 + ltc_ecc_map @2223 + ltc_ecc_mulmod @2224 + ltc_ecc_new_point @2225 + ltc_ecc_projective_add_point @2226 + ltc_ecc_projective_dbl_point @2227 + ltc_ecc_set_point_xyz @2228 + ltc_ecc_verify_key @2229 + ltc_init_multi @2230 + ltc_mp @2231 DATA + ltm_desc @2232 DATA + ltm_prime_tab @2233 DATA + maced_data_length @2234 + mad @2235 DATA + md5_desc @2236 DATA + md5_done @2237 + md5_init @2238 + md5_process @2239 + md5_test @2240 + mem_neq @2241 + memdup @2242 + mifare_cryto_postprocess_data @2243 + mifare_cryto_preprocess_data @2244 + mifare_cryto_preprocess_data_1 @2245 + mifare_cypher_blocks_chained @2246 + mifare_cypher_blocks_chained_1 @2247 + mifare_cypher_single_block @2248 + mifare_cypher_single_block_1 @2249 + mifare_desfire_3des_key_new @2250 + mifare_desfire_3des_key_new_with_version @2251 + mifare_desfire_3k3des_key_new @2252 + mifare_desfire_3k3des_key_new_with_version @2253 + mifare_desfire_abort_transaction @2254 + mifare_desfire_aes_key_new @2255 + mifare_desfire_aes_key_new_with_version @2256 + mifare_desfire_aid_get_aid @2257 + mifare_desfire_aid_new @2258 + mifare_desfire_aid_new_with_mad_aid @2259 + mifare_desfire_authenticate @2260 + mifare_desfire_authenticate_aes @2261 + mifare_desfire_authenticate_iso @2262 + mifare_desfire_change_file_settings @2263 + mifare_desfire_change_key @2264 + mifare_desfire_change_key_settings @2265 + mifare_desfire_clear_record_file @2266 + mifare_desfire_commit_transaction @2267 + mifare_desfire_create_application @2268 + mifare_desfire_create_application_3k3des @2269 + mifare_desfire_create_application_3k3des_iso @2270 + mifare_desfire_create_application_aes @2271 + mifare_desfire_create_application_aes_iso @2272 + mifare_desfire_create_application_iso @2273 + mifare_desfire_create_backup_data_file @2274 + mifare_desfire_create_backup_data_file_iso @2275 + mifare_desfire_create_cyclic_record_file @2276 + mifare_desfire_create_cyclic_record_file_iso @2277 + mifare_desfire_create_linear_record_file @2278 + mifare_desfire_create_linear_record_file_iso @2279 + mifare_desfire_create_std_data_file @2280 + mifare_desfire_create_std_data_file_iso @2281 + mifare_desfire_create_value_file @2282 + mifare_desfire_credit @2283 + mifare_desfire_credit_ex @2284 + mifare_desfire_debit @2285 + mifare_desfire_debit_ex @2286 + mifare_desfire_delete_application @2287 + mifare_desfire_delete_file @2288 + mifare_desfire_des_key_new @2289 + mifare_desfire_des_key_new_with_version @2290 + mifare_desfire_format_picc @2291 + mifare_desfire_free_application_ids @2292 + mifare_desfire_free_mem @2293 + mifare_desfire_get_application_ids @2294 + mifare_desfire_get_card_uid @2295 + mifare_desfire_get_df_names @2296 + mifare_desfire_get_file_ids @2297 + mifare_desfire_get_file_settings @2298 + mifare_desfire_get_key_settings @2299 + mifare_desfire_get_key_version @2300 + mifare_desfire_get_value @2301 + mifare_desfire_get_value_ex @2302 + mifare_desfire_get_version @2303 + mifare_desfire_key_free @2304 + mifare_desfire_key_get_version @2305 + mifare_desfire_key_set_version @2306 + mifare_desfire_limited_credit @2307 + mifare_desfire_limited_credit_ex @2308 + mifare_desfire_select_application @2309 + mifare_desfire_session_key_new @2310 + mifare_desfire_set_ats @2311 + mifare_desfire_set_configuration @2312 + mifare_desfire_set_default_key @2313 + mifare_desfire_tag_free @2314 + mifare_desfire_tag_new @2315 + mifare_desfire_write_data @2316 + mifare_desfire_write_data_ex @2317 + mifare_desfire_write_record @2318 + mifare_desfire_write_record_ex @2319 + mifare_plus_ev1_publickey_str @2320 DATA + mifare_ultralight_read @2321 + mifare_ultralight_tag_free @2322 + mifare_ultralight_tag_new @2323 + mifare_ultralight_write @2324 + mifare_ultralightc_authenticate @2325 + months @2326 DATA + mp_2expt @2327 + mp_abs @2328 + mp_add @2329 + mp_add_d @2330 + mp_addmod @2331 + mp_clamp @2332 + mp_clear @2333 + mp_clear_multi @2334 + mp_cmp @2335 + mp_cmp_d @2336 + mp_cmp_mag @2337 + mp_cnt_lsb @2338 + mp_copy @2339 + mp_count_bits @2340 + mp_div @2341 + mp_div_2 @2342 + mp_div_2d @2343 + mp_div_3 @2344 + mp_div_d @2345 + mp_dr_is_modulus @2346 + mp_dr_reduce @2347 + mp_dr_setup @2348 + mp_exch @2349 + mp_exptmod @2350 + mp_exptmod_fast @2351 + mp_gcd @2352 + mp_get_bit @2353 + mp_get_int @2354 + mp_grow @2355 + mp_init @2356 + mp_init_copy @2357 + mp_init_multi @2358 + mp_init_set @2359 + mp_init_set_int @2360 + mp_init_size @2361 + mp_invmod @2362 + mp_invmod_slow @2363 + mp_is_square @2364 + mp_jacobi @2365 + mp_karatsuba_mul @2366 + mp_karatsuba_sqr @2367 + mp_kronecker @2368 + mp_lcm @2369 + mp_lshd @2370 + mp_mod @2371 + mp_mod_2d @2372 + mp_mod_d @2373 + mp_montgomery_calc_normalization @2374 + mp_montgomery_reduce @2375 + mp_montgomery_setup @2376 + mp_mul @2377 + mp_mul_2 @2378 + mp_mul_2d @2379 + mp_mul_d @2380 + mp_mulmod @2381 + mp_neg @2382 + mp_prime_is_divisible @2383 + mp_prime_is_prime @2384 + mp_prime_miller_rabin @2385 + mp_prime_rabin_miller_trials @2386 + mp_prime_strong_lucas_selfridge @2387 + mp_rand @2388 + mp_rand_digit @2389 + mp_read_radix @2390 + mp_read_unsigned_bin @2391 + mp_reduce @2392 + mp_reduce_2k @2393 + mp_reduce_2k_l @2394 + mp_reduce_2k_setup @2395 + mp_reduce_2k_setup_l @2396 + mp_reduce_is_2k @2397 + mp_reduce_is_2k_l @2398 + mp_reduce_setup @2399 + mp_rshd @2400 + mp_s_rmap @2401 DATA + mp_s_rmap_reverse @2402 DATA + mp_s_rmap_reverse_sz @2403 DATA + mp_set @2404 + mp_set_int @2405 + mp_set_long @2406 + mp_sqr @2407 + mp_sqrmod @2408 + mp_sqrt @2409 + mp_sqrtmod_prime @2410 + mp_sub @2411 + mp_sub_d @2412 + mp_submod @2413 + mp_to_unsigned_bin @2414 + mp_toom_mul @2415 + mp_toom_sqr @2416 + mp_toradix @2417 + mp_unsigned_bin_size @2418 + mp_zero @2419 + mrtd_bac_challenge_ok @2420 + mrtd_bac_check_digit @2421 + mrtd_bac_cmd_data @2422 + mrtd_bac_decrypt_response @2423 + mrtd_bac_eifd_mifd @2424 + mrtd_bac_get_ssc @2425 + mrtd_bac_kenc_kmac @2426 + mrtd_bac_mrz_proto_key_to_kenc_kmac @2427 + mrtd_bac_protected_apdu @2428 + mrtd_bac_randomize_rndifd_kifd @2429 + mrtd_crypto_crypt_3des @2430 + mrtd_crypto_crypt_des @2431 + mrtd_crypto_decrypt_3des @2432 + mrtd_crypto_decrypt_des @2433 + mrtd_crypto_encrypt_3des @2434 + mrtd_crypto_encrypt_des @2435 + mrtd_crypto_fix_parity @2436 + mrtd_crypto_mac @2437 + mrtd_crypto_mac_padding @2438 + mrtd_crypto_padding @2439 + mrtd_crypto_padding_remove @2440 + mrtd_crypto_sha1 @2441 + ndef_card_initialization @2442 + ndef_card_initializationHnd @2443 + ndef_card_initializationM @2444 + ndef_record_to_byte_array @2445 + ndef_record_to_byte_array_mirroring @2446 + newAflListItem @2447 + newEmvTag @2448 + nt4h_change_file_settings_hnd @2449 + nt4h_change_key @2450 + nt4h_change_keyM @2451 + nt4h_change_key_hnd @2452 + nt4h_change_key_pk @2453 + nt4h_change_key_pkM @2454 + nt4h_change_sdm_file_settings @2455 + nt4h_change_sdm_file_settingsM @2456 + nt4h_change_sdm_file_settings_pk @2457 + nt4h_change_sdm_file_settings_pkM @2458 + nt4h_change_standard_file_settings @2459 + nt4h_change_standard_file_settingsM @2460 + nt4h_change_standard_file_settings_pk @2461 + nt4h_change_standard_file_settings_pkM @2462 + nt4h_check_sdm_mac @2463 + nt4h_decrypt_picc_data @2464 + nt4h_decrypt_sdm_enc_file_data @2465 + nt4h_enable_tt @2466 + nt4h_enable_ttM @2467 + nt4h_enable_tt_pk @2468 + nt4h_enable_tt_pkM @2469 + nt4h_get_file_settings @2470 + nt4h_get_file_settingsM @2471 + nt4h_get_file_settings_hnd @2472 + nt4h_get_sdm_ctr @2473 + nt4h_get_sdm_ctrM @2474 + nt4h_get_sdm_ctr_no_auth @2475 + nt4h_get_sdm_ctr_no_authM @2476 + nt4h_get_sdm_ctr_pk @2477 + nt4h_get_sdm_ctr_pkM @2478 + nt4h_get_sdm_read_ctr_hnd @2479 + nt4h_get_tt_status @2480 + nt4h_get_tt_statusM @2481 + nt4h_get_tt_status_hnd @2482 + nt4h_get_tt_status_no_auth @2483 + nt4h_get_tt_status_no_authM @2484 + nt4h_get_tt_status_pk @2485 + nt4h_get_tt_status_pkM @2486 + nt4h_get_uid @2487 + nt4h_get_uidM @2488 + nt4h_get_uid_hnd @2489 + nt4h_get_uid_pk @2490 + nt4h_get_uid_pkM @2491 + nt4h_rid_read_ecc_signature @2492 + nt4h_rid_read_ecc_signatureM @2493 + nt4h_rid_read_ecc_signature_pk @2494 + nt4h_rid_read_ecc_signature_pkM @2495 + nt4h_session_sdm_file_read_enc_key @2496 + nt4h_session_sdm_file_read_mac_key @2497 + nt4h_set_configuration_hnd @2498 + nt4h_set_global_parameters @2499 + nt4h_set_global_parametersM @2500 + nt4h_set_global_parameters_hnd @2501 + nt4h_set_rid @2502 + nt4h_set_ridM @2503 + nt4h_set_rid_pk @2504 + nt4h_set_rid_pkM @2505 + nt4h_tt_change_sdm_file_settings @2506 + nt4h_tt_change_sdm_file_settingsM @2507 + nt4h_tt_change_sdm_file_settings_pk @2508 + nt4h_tt_change_sdm_file_settings_pkM @2509 + nt4h_tt_get_file_settings @2510 + nt4h_tt_get_file_settingsM @2511 + nt4h_unset_rid_pk @2512 + ntag21x_publickey_str @2513 DATA + ntag424dna_publickey_str @2514 DATA + oid_countryName @2515 DATA + oid_ecc_brainpoolP160r1 @2516 DATA + oid_ecc_brainpoolP160t1 @2517 DATA + oid_ecc_brainpoolP192r1 @2518 DATA + oid_ecc_brainpoolP192t1 @2519 DATA + oid_ecc_brainpoolP224r1 @2520 DATA + oid_ecc_brainpoolP224t1 @2521 DATA + oid_ecc_brainpoolP256r1 @2522 DATA + oid_ecc_brainpoolP256t1 @2523 DATA + oid_ecc_brainpoolP320r1 @2524 DATA + oid_ecc_brainpoolP320t1 @2525 DATA + oid_ecc_brainpoolP384r1 @2526 DATA + oid_ecc_brainpoolP384t1 @2527 DATA + oid_ecc_brainpoolP512r1 @2528 DATA + oid_ecc_brainpoolP512t1 @2529 DATA + oid_ecc_prime192v2 @2530 DATA + oid_ecc_prime192v3 @2531 DATA + oid_ecc_prime239v1 @2532 DATA + oid_ecc_prime239v2 @2533 DATA + oid_ecc_prime239v3 @2534 DATA + oid_ecc_secp112r1 @2535 DATA + oid_ecc_secp112r2 @2536 DATA + oid_ecc_secp128r1 @2537 DATA + oid_ecc_secp128r2 @2538 DATA + oid_ecc_secp160k1 @2539 DATA + oid_ecc_secp160r1 @2540 DATA + oid_ecc_secp160r2 @2541 DATA + oid_ecc_secp192k1 @2542 DATA + oid_ecc_secp192r1 @2543 DATA + oid_ecc_secp224k1 @2544 DATA + oid_ecc_secp224r1 @2545 DATA + oid_ecc_secp256k1 @2546 DATA + oid_ecc_secp256r1 @2547 DATA + oid_ecc_secp384r1 @2548 DATA + oid_ecc_secp521r1 @2549 DATA + oid_ecc_sect113r1 @2550 DATA + oid_ecc_sect113r2 @2551 DATA + oid_ecc_sect131r1 @2552 DATA + oid_ecc_sect131r2 @2553 DATA + oid_ecc_sect163k1 @2554 DATA + oid_ecc_sect163r1 @2555 DATA + oid_ecc_sect163r2 @2556 DATA + oid_ecc_sect193r1 @2557 DATA + oid_ecc_sect193r2 @2558 DATA + oid_ecc_sect233k1 @2559 DATA + oid_ecc_sect233r1 @2560 DATA + oid_ecc_sect239k1 @2561 DATA + oid_ecc_sect283k1 @2562 DATA + oid_ecc_sect283r1 @2563 DATA + oid_ecc_sect409k1 @2564 DATA + oid_ecc_sect409r1 @2565 DATA + oid_ecc_sect571k1 @2566 DATA + oid_ecc_sect571r1 @2567 DATA + oid_ecdsa_prime_field @2568 DATA + oid_icao_csca_master_list @2569 DATA + oid_icao_mrtd_security_object @2570 DATA + oid_pkcs1_mgf @2571 DATA + oid_pkcs7_signed_data @2572 DATA + oid_pkcs9_message_digest @2573 DATA + oid_pub_key_ecdsa @2574 DATA + oid_pub_key_rsa @2575 DATA + oid_sha1 @2576 DATA + oid_sha224 @2577 DATA + oid_sha256 @2578 DATA + oid_sha384 @2579 DATA + oid_sha512 @2580 DATA + oid_sha512_224 @2581 DATA + oid_sha512_256 @2582 DATA + oid_sig_sch_ecdsa_with_sha1 @2583 DATA + oid_sig_sch_ecdsa_with_sha224 @2584 DATA + oid_sig_sch_ecdsa_with_sha256 @2585 DATA + oid_sig_sch_ecdsa_with_sha384 @2586 DATA + oid_sig_sch_ecdsa_with_sha512 @2587 DATA + oid_sig_sch_rsa_pss @2588 DATA + oid_sig_sch_rsa_sha1 @2589 DATA + oid_sig_sch_rsa_sha224 @2590 DATA + oid_sig_sch_rsa_sha256 @2591 DATA + oid_sig_sch_rsa_sha384 @2592 DATA + oid_sig_sch_rsa_sha512 @2593 DATA + oid_sig_sch_rsa_sha512_224 @2594 DATA + oid_sig_sch_rsa_sha512_256 @2595 DATA + oid_x509ext_aki @2596 DATA + oid_x509ext_ski @2597 DATA + oids @2598 DATA + oids_ecc_curves @2599 DATA + oids_hash_algs @2600 DATA + oids_pub_key_types @2601 DATA + oids_signature_schemes @2602 DATA + open_ISO7816_interface @2603 + open_ISO7816_interfaceHnd @2604 + open_ISO7816_interfaceM @2605 + open_devs @2606 DATA + padded_data_length @2607 + parseEmvTag @2608 + parse_open_arg @2609 + pemCertToDer @2610 + pk_get_oid @2611 + pk_oid_cmp_with_asn1 @2612 + pk_oid_cmp_with_ulong @2613 + pk_oid_num_to_str @2614 + pk_oid_str_to_num @2615 + pkcs7GetCert @2616 + pkcs7GetCertNodPos @2617 + pkcs7GetDataGroupHash @2618 + pkcs7GetDataGroupsHashAlgorithm @2619 + pkcs7GetDigestAlgorithms @2620 + pkcs7GetDigestAlgorithmsNodPos @2621 + pkcs7GetEncapContentInfoNodPos @2622 + pkcs7GetLDSSecurityObject @2623 + pkcs7GetLDSSecurityObjectDigest @2624 + pkcs7GetLDSSecurityObjectPos @2625 + pkcs7GetSignature @2626 + pkcs7GetSignatureAlgorithm @2627 + pkcs7GetSignatureAlgorithmPos @2628 + pkcs7GetSignaturePos @2629 + pkcs7GetSignedAttrs @2630 + pkcs7GetSignedAttrsDigestAlgPos @2631 + pkcs7GetSignedAttrsDigestAlgorithm @2632 + pkcs7GetSignedAttrsPos @2633 + pkcs7GetSignerId @2634 + pkcs7GetSignerIdPos @2635 + pkcs7GetSignerIdVersion @2636 + pkcs7GetSignerInfosNodPos @2637 + pkcs7ParseDERSignatureScheme @2638 + pkcs7ParseRsaPSSParams @2639 + pkcs7VerifySignature @2640 + pkcs_1_mgf1 @2641 + pkcs_1_oaep_decode @2642 + pkcs_1_oaep_encode @2643 + pkcs_1_pss_decode @2644 + pkcs_1_pss_encode @2645 + pkcs_1_v1_5_decode @2646 + pkcs_1_v1_5_encode @2647 + pn512_transceiveHnd @2648 + pn512_transceive_mode_startHnd @2649 + pn512_transceive_mode_stopHnd @2650 + pre_multi_open @2651 + print_com_ports @2652 + print_desfire_version @2653 + print_index @2654 + private_AES_set_decrypt_key @2655 + private_AES_set_encrypt_key @2656 + prn_modem_status @2657 + prng_descriptor @2658 DATA + prng_is_valid @2659 + pub_key_ab @2660 DATA + pub_key_designator @2661 DATA + pub_key_field @2662 DATA + pub_key_g @2663 DATA + pub_key_k @2664 DATA + pub_key_modulus @2665 DATA + pub_key_r @2666 DATA + pub_key_size_bits @2667 DATA + r_block_transceive @2668 + r_block_transceiveHnd @2669 + r_block_transceiveM @2670 + rand_bn_bits @2671 + rand_bn_upto @2672 + rand_prime @2673 + readAsyncUID @2674 + readPartialAsyncUID @2675 + read_ndef_record @2676 + read_ndef_recordHnd @2677 + read_ndef_recordM @2678 + register_cipher @2679 + register_hash @2680 + register_prng @2681 + removeCallbackHandlers @2682 + removeData @2683 + reset_pin_set @2684 + rijndael_desc @2685 DATA + rijndael_done @2686 + rijndael_ecb_decrypt @2687 + rijndael_ecb_encrypt @2688 + rijndael_keysize @2689 + rijndael_setup @2690 + rijndael_test @2691 + rng_get_bytes @2692 + rng_make_prng @2693 + rol @2694 + rs232_init_programming @2695 + rs232_serial_port_init @2696 + rs232_serial_port_init_Hnd @2697 + rs232_serial_port_init_Hnd_device_type @2698 + rsa_decrypt_key_ex @2699 + rsa_encrypt_key_ex @2700 + rsa_exptmod @2701 + rsa_free @2702 + rsa_import @2703 + rsa_import_x509 @2704 + rsa_key_byte_sizes @2705 DATA + rsa_make_key @2706 + rsa_set_crt_params @2707 + rsa_set_factors @2708 + rsa_set_key @2709 + rsa_sign_hash_ex @2710 + rsa_verify_hash_ex @2711 + s_block_deselect @2712 + s_block_deselectHnd @2713 + s_block_deselectM @2714 + s_mp_add @2715 + s_mp_exptmod @2716 + s_mp_mul_digs @2717 + s_mp_mul_high_digs @2718 + s_mp_sqr @2719 + s_mp_sub @2720 + send_pending @2721 + sessionErrorCallback @2722 DATA + setBit @2723 + setCardDetectedCallback @2724 + setCardRemovedCallback @2725 + setGPIOPin @2726 + setSessionErrorCallback @2727 + sha1_desc @2728 DATA + sha1_done @2729 + sha1_init @2730 + sha1_process @2731 + sha1_test @2732 + sha224_desc @2733 DATA + sha224_done @2734 + sha224_init @2735 + sha224_test @2736 + sha256_desc @2737 DATA + sha256_done @2738 + sha256_init @2739 + sha256_process @2740 + sha256_test @2741 + sha384_desc @2742 DATA + sha384_done @2743 + sha384_init @2744 + sha384_test @2745 + sha512_224_desc @2746 DATA + sha512_224_done @2747 + sha512_224_init @2748 + sha512_224_test @2749 + sha512_256_desc @2750 DATA + sha512_256_done @2751 + sha512_256_init @2752 + sha512_256_test @2753 + sha512_desc @2754 DATA + sha512_done @2755 + sha512_init @2756 + sha512_process @2757 + sha512_test @2758 + signature_scheme_names @2759 DATA + sorted_uids @2760 DATA + sprng_add_entropy @2761 + sprng_desc @2762 DATA + sprng_done @2763 + sprng_export @2764 + sprng_import @2765 + sprng_read @2766 + sprng_ready @2767 + sprng_start @2768 + sprng_test @2769 + static_internal_store_keys @2770 + stbi_convert_iphone_png_to_rgb @2771 + stbi_convert_iphone_png_to_rgb_thread @2772 + stbi_failure_reason @2773 + stbi_hdr_to_ldr_gamma @2774 + stbi_hdr_to_ldr_scale @2775 + stbi_image_free @2776 + stbi_info @2777 + stbi_info_from_callbacks @2778 + stbi_info_from_file @2779 + stbi_info_from_memory @2780 + stbi_is_16_bit @2781 + stbi_is_16_bit_from_callbacks @2782 + stbi_is_16_bit_from_file @2783 + stbi_is_16_bit_from_memory @2784 + stbi_is_hdr @2785 + stbi_is_hdr_from_callbacks @2786 + stbi_is_hdr_from_file @2787 + stbi_is_hdr_from_memory @2788 + stbi_ldr_to_hdr_gamma @2789 + stbi_ldr_to_hdr_scale @2790 + stbi_load @2791 + stbi_load_16 @2792 + stbi_load_16_from_callbacks @2793 + stbi_load_16_from_memory @2794 + stbi_load_from_callbacks @2795 + stbi_load_from_file @2796 + stbi_load_from_file_16 @2797 + stbi_load_from_memory @2798 + stbi_load_gif_from_memory @2799 + stbi_loadf @2800 + stbi_loadf_from_callbacks @2801 + stbi_loadf_from_file @2802 + stbi_loadf_from_memory @2803 + stbi_set_flip_vertically_on_load @2804 + stbi_set_flip_vertically_on_load_thread @2805 + stbi_set_unpremultiply_on_load @2806 + stbi_set_unpremultiply_on_load_thread @2807 + stbi_zlib_decode_buffer @2808 + stbi_zlib_decode_malloc @2809 + stbi_zlib_decode_malloc_guesssize @2810 + stbi_zlib_decode_malloc_guesssize_headerflag @2811 + stbi_zlib_decode_noheader_buffer @2812 + stbi_zlib_decode_noheader_malloc @2813 + strTimeToEpoch @2814 + str_FilePrefix @2815 DATA + str_SubFolder @2816 DATA + strmem @2817 + strmempos @2818 + szRApdu @2819 DATA + test_desfire_ver @2820 + test_i_block @2821 + test_ptr @2822 DATA + test_ptr_size @2823 DATA + test_reader_fw_version @2824 + test_reader_sn @2825 + timespan_prn @2826 + timespan_start @2827 + tls_add_alpn @2828 + tls_alert @2829 + tls_alpn @2830 + tls_alpn_contains @2831 + tls_buffer_clear @2832 + tls_build_alert @2833 + tls_build_certificate @2834 + tls_build_certificate_verify @2835 + tls_build_change_cipher_spec @2836 + tls_build_client_key_exchange @2837 + tls_build_done @2838 + tls_build_finished @2839 + tls_build_hello @2840 + tls_build_message @2841 + tls_certificate_chain_is_valid @2842 + tls_certificate_chain_is_valid_root @2843 + tls_certificate_is_valid @2844 + tls_certificate_set_algorithm @2845 + tls_certificate_set_copy @2846 + tls_certificate_set_copy_date @2847 + tls_certificate_set_exponent @2848 + tls_certificate_set_key @2849 + tls_certificate_set_priv @2850 + tls_certificate_set_serial @2851 + tls_certificate_set_sign_key @2852 + tls_certificate_to_string @2853 + tls_certificate_valid_subject @2854 + tls_certificate_valid_subject_name @2855 + tls_certificate_verify_signature @2856 + tls_choose_cipher @2857 + tls_cipher_is_ephemeral @2858 + tls_cipher_is_fs @2859 + tls_cipher_name @2860 + tls_cipher_supported @2861 + tls_clear_certificates @2862 + tls_client_connect @2863 + tls_client_verified @2864 + tls_close_notify @2865 + tls_consume_stream @2866 + tls_create_certificate @2867 + tls_create_context @2868 + tls_create_packet @2869 + tls_create_packet_alt @2870 + tls_default_verify @2871 + tls_destroy_certificate @2872 + tls_destroy_context @2873 + tls_destroy_packet @2874 + tls_established @2875 + tls_get_message @2876 + tls_get_write_buffer @2877 + tls_init @2878 + tls_is_broken @2879 + tls_is_ecdsa @2880 + tls_load_certificates @2881 + tls_load_private_key @2882 + tls_load_root_certificates @2883 + tls_make_exportable @2884 + tls_make_ktls @2885 + tls_packet_append @2886 + tls_packet_uint16 @2887 + tls_packet_uint24 @2888 + tls_packet_uint32 @2889 + tls_packet_uint8 @2890 + tls_packet_update @2891 + tls_packet_update_tbs @2892 + tls_parse_certificate @2893 + tls_parse_finished @2894 + tls_parse_hello @2895 + tls_parse_message @2896 + tls_parse_payload @2897 + tls_parse_server_hello_done @2898 + tls_parse_server_key_exchange @2899 + tls_parse_verify @2900 + tls_pem_decode @2901 + tls_pending @2902 + tls_random @2903 + tls_read @2904 + tls_read_clear @2905 + tls_remote_error @2906 + tls_sni @2907 + tls_sni_set @2908 + tls_ufr_status @2909 DATA + tls_unmake_ktls @2910 + tls_write @2911 + tmp_obj @2912 DATA + tmp_obj_len @2913 DATA + toUpper @2914 + tohex @2915 + transferBitmapData @2916 + uFR_APDU_Start @2917 + uFR_APDU_StartM @2918 + uFR_APDU_Stop @2919 + uFR_APDU_StopM @2920 + uFR_APDU_Transceive @2921 + uFR_APDU_TransceiveHnd @2922 + uFR_APDU_TransceiveM @2923 + uFR_DESFIRE_SendICFG @2924 + uFR_DESFIRE_Start @2925 + uFR_DESFIRE_StartHnd @2926 + uFR_DESFIRE_StartM @2927 + uFR_DESFIRE_Stop @2928 + uFR_DESFIRE_StopHnd @2929 + uFR_DESFIRE_StopM @2930 + uFR_Hnd_Create @2931 + uFR_Hnd_Destroy @2932 + uFR_Hnd_SetGlobal @2933 + uFR_Hnd_assign_try_port @2934 + uFR_SAM_DesfireChange2k3desKey_2k3desAuth @2935 + uFR_SAM_DesfireChange2k3desKey_2k3desAuthM @2936 + uFR_SAM_DesfireChange2k3desKey_DesAuth @2937 + uFR_SAM_DesfireChange2k3desKey_DesAuthM @2938 + uFR_SAM_DesfireChange3k3desKey_3k3desAuth @2939 + uFR_SAM_DesfireChange3k3desKey_3k3desAuthM @2940 + uFR_SAM_DesfireChangeAesKeyHnd @2941 + uFR_SAM_DesfireChangeAesKey_AesAuth @2942 + uFR_SAM_DesfireChangeDesKey_2k3desAuth @2943 + uFR_SAM_DesfireChangeDesKey_2k3desAuthM @2944 + uFR_SAM_DesfireChangeDesKey_DesAuth @2945 + uFR_SAM_DesfireChangeDesKey_DesAuthM @2946 + uFR_SAM_DesfireChangeFileSettings2k3desAuth @2947 + uFR_SAM_DesfireChangeFileSettings2k3desAuthM @2948 + uFR_SAM_DesfireChangeFileSettings3k3desAuth @2949 + uFR_SAM_DesfireChangeFileSettings3k3desAuthM @2950 + uFR_SAM_DesfireChangeFileSettingsAesAuth @2951 + uFR_SAM_DesfireChangeFileSettingsAesAuthM @2952 + uFR_SAM_DesfireChangeFileSettingsDesAuth @2953 + uFR_SAM_DesfireChangeFileSettingsDesAuthM @2954 + uFR_SAM_DesfireChangeFileSettingsHnd @2955 + uFR_SAM_DesfireChangeFileSettingsSdm @2956 + uFR_SAM_DesfireChangeFileSettingsSdmHnd @2957 + uFR_SAM_DesfireChangeFileSettingsSdmM @2958 + uFR_SAM_DesfireChangeKeySettings2k3desAuth @2959 + uFR_SAM_DesfireChangeKeySettings2k3desAuthM @2960 + uFR_SAM_DesfireChangeKeySettings3k3desAuth @2961 + uFR_SAM_DesfireChangeKeySettings3k3desAuthM @2962 + uFR_SAM_DesfireChangeKeySettingsAesAuth @2963 + uFR_SAM_DesfireChangeKeySettingsAesAuthM @2964 + uFR_SAM_DesfireChangeKeySettingsDesAuth @2965 + uFR_SAM_DesfireChangeKeySettingsDesAuthM @2966 + uFR_SAM_DesfireChangeKeySettingsHnd @2967 + uFR_SAM_DesfireChangeKey_AesAuthM @2968 + uFR_SAM_DesfireChangeMasterKey @2969 + uFR_SAM_DesfireChangeMasterKeyM @2970 + uFR_SAM_DesfireClearRecordFile2k3desAuth @2971 + uFR_SAM_DesfireClearRecordFile2k3desAuth_2 @2972 + uFR_SAM_DesfireClearRecordFile2k3desAuth_2M @2973 + uFR_SAM_DesfireClearRecordFile3k3desAuth @2974 + uFR_SAM_DesfireClearRecordFile3k3desAuthM @2975 + uFR_SAM_DesfireClearRecordFile3k3desAuth_2 @2976 + uFR_SAM_DesfireClearRecordFile3k3desAuth_2M @2977 + uFR_SAM_DesfireClearRecordFileAesAuth @2978 + uFR_SAM_DesfireClearRecordFileAesAuthM @2979 + uFR_SAM_DesfireClearRecordFileAesAuth_2 @2980 + uFR_SAM_DesfireClearRecordFileAesAuth_2M @2981 + uFR_SAM_DesfireClearRecordFileDesAuth @2982 + uFR_SAM_DesfireClearRecordFileDesAuth_2 @2983 + uFR_SAM_DesfireClearRecordFileDesAuth_2M @2984 + uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuth @2985 + uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM @2986 + uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuth @2987 + uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM @2988 + uFR_SAM_DesfireClearRecordFile_TransMac_AesAuth @2989 + uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM @2990 + uFR_SAM_DesfireClearRecordFile_TransMac_DesAuth @2991 + uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM @2992 + uFR_SAM_DesfireClearRecordHnd @2993 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuth @2994 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIso @2995 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM @2996 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM @2997 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuth @2998 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIso @2999 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM @3000 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM @3001 + uFR_SAM_DesfireCreate3k3desApplicationAesAuth @3002 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthIso @3003 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM @3004 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthM @3005 + uFR_SAM_DesfireCreate3k3desApplicationDesAuth @3006 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthIso @3007 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM @3008 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthM @3009 + uFR_SAM_DesfireCreateAesApplication2k3desAuth @3010 + uFR_SAM_DesfireCreateAesApplication2k3desAuthIso @3011 + uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM @3012 + uFR_SAM_DesfireCreateAesApplication2k3desAuthM @3013 + uFR_SAM_DesfireCreateAesApplication3k3desAuth @3014 + uFR_SAM_DesfireCreateAesApplication3k3desAuthIso @3015 + uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM @3016 + uFR_SAM_DesfireCreateAesApplication3k3desAuthM @3017 + uFR_SAM_DesfireCreateAesApplicationAesAuth @3018 + uFR_SAM_DesfireCreateAesApplicationAesAuthIso @3019 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscd @3020 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM @3021 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM @3022 + uFR_SAM_DesfireCreateAesApplicationAesAuthM @3023 + uFR_SAM_DesfireCreateAesApplicationDesAuth @3024 + uFR_SAM_DesfireCreateAesApplicationDesAuthIso @3025 + uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM @3026 + uFR_SAM_DesfireCreateAesApplicationDesAuthM @3027 + uFR_SAM_DesfireCreateApplicationHnd @3028 + uFR_SAM_DesfireCreateApplication_iso_Hnd @3029 + uFR_SAM_DesfireCreateApplication_iso_ascd_Hnd @3030 + uFR_SAM_DesfireCreateBackupDataFile2k3desAuth @3031 + uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM @3032 + uFR_SAM_DesfireCreateBackupDataFile3k3desAuth @3033 + uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM @3034 + uFR_SAM_DesfireCreateBackupDataFileAesAuth @3035 + uFR_SAM_DesfireCreateBackupDataFileAesAuthM @3036 + uFR_SAM_DesfireCreateBackupDataFileDesAuth @3037 + uFR_SAM_DesfireCreateBackupDataFileHnd @3038 + uFR_SAM_DesfireCreateBackupdDataFileDesAuthM @3039 + uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuth @3040 + uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM @3041 + uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuth @3042 + uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM @3043 + uFR_SAM_DesfireCreateCyclicRecordFileAesAuth @3044 + uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM @3045 + uFR_SAM_DesfireCreateCyclicRecordFileDesAuth @3046 + uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM @3047 + uFR_SAM_DesfireCreateDesApplication2k3desAuth @3048 + uFR_SAM_DesfireCreateDesApplication2k3desAuthIso @3049 + uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM @3050 + uFR_SAM_DesfireCreateDesApplication2k3desAuthM @3051 + uFR_SAM_DesfireCreateDesApplication3k3desAuth @3052 + uFR_SAM_DesfireCreateDesApplication3k3desAuthIso @3053 + uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM @3054 + uFR_SAM_DesfireCreateDesApplication3k3desAuthM @3055 + uFR_SAM_DesfireCreateDesApplicationAesAuth @3056 + uFR_SAM_DesfireCreateDesApplicationAesAuthIso @3057 + uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM @3058 + uFR_SAM_DesfireCreateDesApplicationAesAuthM @3059 + uFR_SAM_DesfireCreateDesApplicationDesAuth @3060 + uFR_SAM_DesfireCreateDesApplicationDesAuthIso @3061 + uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM @3062 + uFR_SAM_DesfireCreateDesApplicationDesAuthM @3063 + uFR_SAM_DesfireCreateLinearRecordFile2k3desAuth @3064 + uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM @3065 + uFR_SAM_DesfireCreateLinearRecordFile3k3desAuth @3066 + uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM @3067 + uFR_SAM_DesfireCreateLinearRecordFileAesAuth @3068 + uFR_SAM_DesfireCreateLinearRecordFileAesAuthM @3069 + uFR_SAM_DesfireCreateLinearRecordFileDesAuth @3070 + uFR_SAM_DesfireCreateLinearRecordFileDesAuthM @3071 + uFR_SAM_DesfireCreateRecordFileHnd @3072 + uFR_SAM_DesfireCreateStdDataFile2k3desAuth @3073 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthIso @3074 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM @3075 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthM @3076 + uFR_SAM_DesfireCreateStdDataFile3k3desAuth @3077 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthIso @3078 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM @3079 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthM @3080 + uFR_SAM_DesfireCreateStdDataFileAesAuth @3081 + uFR_SAM_DesfireCreateStdDataFileAesAuthIso @3082 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM @3083 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdm @3084 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM @3085 + uFR_SAM_DesfireCreateStdDataFileAesAuthM @3086 + uFR_SAM_DesfireCreateStdDataFileDesAuth @3087 + uFR_SAM_DesfireCreateStdDataFileDesAuthIso @3088 + uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM @3089 + uFR_SAM_DesfireCreateStdDataFileDesAuthM @3090 + uFR_SAM_DesfireCreateStdDataFileHnd @3091 + uFR_SAM_DesfireCreateStdDataFile_iso_Hnd @3092 + uFR_SAM_DesfireCreateStdDataFile_iso_sdm_Hnd @3093 + uFR_SAM_DesfireCreateTransMacFile2k3desAuth @3094 + uFR_SAM_DesfireCreateTransMacFile2k3desAuthM @3095 + uFR_SAM_DesfireCreateTransMacFile3k3desAuth @3096 + uFR_SAM_DesfireCreateTransMacFile3k3desAuthM @3097 + uFR_SAM_DesfireCreateTransMacFileAesAuth @3098 + uFR_SAM_DesfireCreateTransMacFileAesAuthM @3099 + uFR_SAM_DesfireCreateTransMacFileDesAuth @3100 + uFR_SAM_DesfireCreateTransMacFileDesAuthM @3101 + uFR_SAM_DesfireCreateTransMacFileHnd @3102 + uFR_SAM_DesfireCreateValueFile2k3desAuth @3103 + uFR_SAM_DesfireCreateValueFile2k3desAuthM @3104 + uFR_SAM_DesfireCreateValueFile3k3desAuth @3105 + uFR_SAM_DesfireCreateValueFile3k3desAuthM @3106 + uFR_SAM_DesfireCreateValueFileAesAuth @3107 + uFR_SAM_DesfireCreateValueFileAesAuthM @3108 + uFR_SAM_DesfireCreateValueFileDesAuth @3109 + uFR_SAM_DesfireCreateValueFileDesAuthM @3110 + uFR_SAM_DesfireCreateValueFileHnd @3111 + uFR_SAM_DesfireDecreaseValueFile2k3desAuth @3112 + uFR_SAM_DesfireDecreaseValueFile2k3desAuthM @3113 + uFR_SAM_DesfireDecreaseValueFile3k3desAuth @3114 + uFR_SAM_DesfireDecreaseValueFile3k3desAuthM @3115 + uFR_SAM_DesfireDecreaseValueFileAesAuth @3116 + uFR_SAM_DesfireDecreaseValueFileAesAuthM @3117 + uFR_SAM_DesfireDecreaseValueFileDesAuth @3118 + uFR_SAM_DesfireDecreaseValueFileDesAuthM @3119 + uFR_SAM_DesfireDecreaseValueFileHnd @3120 + uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuth @3121 + uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM @3122 + uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuth @3123 + uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM @3124 + uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuth @3125 + uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM @3126 + uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuth @3127 + uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM @3128 + uFR_SAM_DesfireDeleteApplication2k3desAuth @3129 + uFR_SAM_DesfireDeleteApplication2k3desAuthM @3130 + uFR_SAM_DesfireDeleteApplication3k3desAuth @3131 + uFR_SAM_DesfireDeleteApplication3k3desAuthM @3132 + uFR_SAM_DesfireDeleteApplicationAesAuth @3133 + uFR_SAM_DesfireDeleteApplicationAesAuthM @3134 + uFR_SAM_DesfireDeleteApplicationDesAuth @3135 + uFR_SAM_DesfireDeleteApplicationDesAuthM @3136 + uFR_SAM_DesfireDeleteApplicationHnd @3137 + uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuth @3138 + uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM @3139 + uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuth @3140 + uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM @3141 + uFR_SAM_DesfireDeleteApplication_app_master_AesAuth @3142 + uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM @3143 + uFR_SAM_DesfireDeleteApplication_app_master_DesAuth @3144 + uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM @3145 + uFR_SAM_DesfireDeleteFile2k3desAuth @3146 + uFR_SAM_DesfireDeleteFile2k3desAuthM @3147 + uFR_SAM_DesfireDeleteFile3k3desAuth @3148 + uFR_SAM_DesfireDeleteFile3k3desAuthM @3149 + uFR_SAM_DesfireDeleteFileAesAuth @3150 + uFR_SAM_DesfireDeleteFileAesAuthM @3151 + uFR_SAM_DesfireDeleteFileDesAuth @3152 + uFR_SAM_DesfireDeleteFileDesAuthM @3153 + uFR_SAM_DesfireDeleteFileHnd @3154 + uFR_SAM_DesfireFormatCard2k3desAuth @3155 + uFR_SAM_DesfireFormatCard2k3desAuthM @3156 + uFR_SAM_DesfireFormatCard3k3desAuth @3157 + uFR_SAM_DesfireFormatCard3k3desAuthM @3158 + uFR_SAM_DesfireFormatCardAesAuth @3159 + uFR_SAM_DesfireFormatCardAesAuthM @3160 + uFR_SAM_DesfireFormatCardDesAuth @3161 + uFR_SAM_DesfireFormatCardDesAuthM @3162 + uFR_SAM_DesfireFormatCardHnd @3163 + uFR_SAM_DesfireGetApplicationIds2k3desAuth @3164 + uFR_SAM_DesfireGetApplicationIds2k3desAuthM @3165 + uFR_SAM_DesfireGetApplicationIds3k3desAuth @3166 + uFR_SAM_DesfireGetApplicationIds3k3desAuthM @3167 + uFR_SAM_DesfireGetApplicationIdsAesAuth @3168 + uFR_SAM_DesfireGetApplicationIdsAesAuthM @3169 + uFR_SAM_DesfireGetApplicationIdsDesAuth @3170 + uFR_SAM_DesfireGetApplicationIdsDesAuthM @3171 + uFR_SAM_DesfireGetApplicationIdsHnd @3172 + uFR_SAM_DesfireGetFileSettings2k3desAuth @3173 + uFR_SAM_DesfireGetFileSettings2k3desAuthM @3174 + uFR_SAM_DesfireGetFileSettings3k3desAuth @3175 + uFR_SAM_DesfireGetFileSettings3k3desAuthM @3176 + uFR_SAM_DesfireGetFileSettingsAesAuth @3177 + uFR_SAM_DesfireGetFileSettingsAesAuthM @3178 + uFR_SAM_DesfireGetFileSettingsDesAuth @3179 + uFR_SAM_DesfireGetFileSettingsDesAuthM @3180 + uFR_SAM_DesfireGetFileSettingsHnd @3181 + uFR_SAM_DesfireGetFileSettingsSdmAesAuth @3182 + uFR_SAM_DesfireGetFileSettingsSdmAesAuthM @3183 + uFR_SAM_DesfireGetFileSettingsSdmHnd @3184 + uFR_SAM_DesfireGetKeySettings2k3desAuth @3185 + uFR_SAM_DesfireGetKeySettings2k3desAuthM @3186 + uFR_SAM_DesfireGetKeySettings3k3desAuth @3187 + uFR_SAM_DesfireGetKeySettings3k3desAuthM @3188 + uFR_SAM_DesfireGetKeySettingsAesAuth @3189 + uFR_SAM_DesfireGetKeySettingsAesAuthM @3190 + uFR_SAM_DesfireGetKeySettingsDesAuth @3191 + uFR_SAM_DesfireGetKeySettingsDesAuthM @3192 + uFR_SAM_DesfireGetKeySettingsHnd @3193 + uFR_SAM_DesfireGetStdFileSize2k3desAuth @3194 + uFR_SAM_DesfireGetStdFileSize2k3desAuthM @3195 + uFR_SAM_DesfireGetStdFileSize3k3desAuth @3196 + uFR_SAM_DesfireGetStdFileSize3k3desAuthM @3197 + uFR_SAM_DesfireGetStdFileSizeAesAuth @3198 + uFR_SAM_DesfireGetStdFileSizeAesAuthM @3199 + uFR_SAM_DesfireGetStdFileSizeDesAuth @3200 + uFR_SAM_DesfireGetStdFileSizeDesAuthM @3201 + uFR_SAM_DesfireIncreaseValueFile2k3desAuth @3202 + uFR_SAM_DesfireIncreaseValueFile2k3desAuthM @3203 + uFR_SAM_DesfireIncreaseValueFile3k3desAuth @3204 + uFR_SAM_DesfireIncreaseValueFile3k3desAuthM @3205 + uFR_SAM_DesfireIncreaseValueFileAesAuth @3206 + uFR_SAM_DesfireIncreaseValueFileAesAuthM @3207 + uFR_SAM_DesfireIncreaseValueFileDesAuth @3208 + uFR_SAM_DesfireIncreaseValueFileDesAuthM @3209 + uFR_SAM_DesfireIncreaseValueFileHnd @3210 + uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuth @3211 + uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM @3212 + uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuth @3213 + uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM @3214 + uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuth @3215 + uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM @3216 + uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuth @3217 + uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM @3218 + uFR_SAM_DesfireReadRecords2k3desAuth @3219 + uFR_SAM_DesfireReadRecords2k3desAuthM @3220 + uFR_SAM_DesfireReadRecords3k3desAuth @3221 + uFR_SAM_DesfireReadRecords3k3desAuthM @3222 + uFR_SAM_DesfireReadRecordsAesAuth @3223 + uFR_SAM_DesfireReadRecordsAesAuthM @3224 + uFR_SAM_DesfireReadRecordsDesAuth @3225 + uFR_SAM_DesfireReadRecordsDesAuthM @3226 + uFR_SAM_DesfireReadRecordsHnd @3227 + uFR_SAM_DesfireReadStdDataFile2k3desAuth @3228 + uFR_SAM_DesfireReadStdDataFile2k3desAuthM @3229 + uFR_SAM_DesfireReadStdDataFile3k3desAuth @3230 + uFR_SAM_DesfireReadStdDataFile3k3desAuthM @3231 + uFR_SAM_DesfireReadStdDataFileAesAuth @3232 + uFR_SAM_DesfireReadStdDataFileAesAuthM @3233 + uFR_SAM_DesfireReadStdDataFileDesAuth @3234 + uFR_SAM_DesfireReadStdDataFileDesAuthM @3235 + uFR_SAM_DesfireReadStdDataFileHnd @3236 + uFR_SAM_DesfireReadValueFile2k3desAuth @3237 + uFR_SAM_DesfireReadValueFile2k3desAuthM @3238 + uFR_SAM_DesfireReadValueFile3k3desAuth @3239 + uFR_SAM_DesfireReadValueFile3k3desAuthM @3240 + uFR_SAM_DesfireReadValueFileAesAuth @3241 + uFR_SAM_DesfireReadValueFileAesAuthM @3242 + uFR_SAM_DesfireReadValueFileDesAuth @3243 + uFR_SAM_DesfireReadValueFileDesAuthM @3244 + uFR_SAM_DesfireReadValueFileHnd @3245 + uFR_SAM_DesfireSetConfiguration2k3desAuth @3246 + uFR_SAM_DesfireSetConfiguration2k3desAuthM @3247 + uFR_SAM_DesfireSetConfiguration3k3desAuth @3248 + uFR_SAM_DesfireSetConfiguration3k3desAuthM @3249 + uFR_SAM_DesfireSetConfigurationAesAuth @3250 + uFR_SAM_DesfireSetConfigurationAesAuthM @3251 + uFR_SAM_DesfireSetConfigurationDesAuth @3252 + uFR_SAM_DesfireSetConfigurationDesAuthM @3253 + uFR_SAM_DesfireSetConfigurationExHnd @3254 + uFR_SAM_DesfireSetConfigurationHnd @3255 + uFR_SAM_DesfireSetTransactionTimerAesAuth @3256 + uFR_SAM_DesfireSetTransactionTimerAesAuthM @3257 + uFR_SAM_DesfireWriteBackupDataFile2k3desAuth @3258 + uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM @3259 + uFR_SAM_DesfireWriteBackupDataFile3k3desAuth @3260 + uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM @3261 + uFR_SAM_DesfireWriteBackupDataFileAesAuth @3262 + uFR_SAM_DesfireWriteBackupDataFileAesAuthM @3263 + uFR_SAM_DesfireWriteBackupDataFileDesAuth @3264 + uFR_SAM_DesfireWriteBackupDataFileDesAuthM @3265 + uFR_SAM_DesfireWriteBackupDataFileHnd @3266 + uFR_SAM_DesfireWriteRecord2k3desAuth @3267 + uFR_SAM_DesfireWriteRecord2k3desAuthM @3268 + uFR_SAM_DesfireWriteRecord3k3desAuth @3269 + uFR_SAM_DesfireWriteRecord3k3desAuthM @3270 + uFR_SAM_DesfireWriteRecordAesAuth @3271 + uFR_SAM_DesfireWriteRecordAesAuthM @3272 + uFR_SAM_DesfireWriteRecordDesAuth @3273 + uFR_SAM_DesfireWriteRecordDesAuthM @3274 + uFR_SAM_DesfireWriteRecordHnd @3275 + uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuth @3276 + uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM @3277 + uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuth @3278 + uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM @3279 + uFR_SAM_DesfireWriteRecord_TransMac_AesAuth @3280 + uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM @3281 + uFR_SAM_DesfireWriteRecord_TransMac_DesAuth @3282 + uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM @3283 + uFR_SAM_DesfireWriteStdDataFile2k3desAuth @3284 + uFR_SAM_DesfireWriteStdDataFile2k3desAuthM @3285 + uFR_SAM_DesfireWriteStdDataFile3k3desAuth @3286 + uFR_SAM_DesfireWriteStdDataFile3k3desAuthM @3287 + uFR_SAM_DesfireWriteStdDataFileAesAuth @3288 + uFR_SAM_DesfireWriteStdDataFileAesAuthM @3289 + uFR_SAM_DesfireWriteStdDataFileDesAuth @3290 + uFR_SAM_DesfireWriteStdDataFileDesAuthM @3291 + uFR_SAM_DesfireWriteStdDataFileHnd @3292 + uFR_SAM_GetDesfireUid2k3desAuth @3293 + uFR_SAM_GetDesfireUid2k3desAuthM @3294 + uFR_SAM_GetDesfireUid3k3desAuth @3295 + uFR_SAM_GetDesfireUid3k3desAuthM @3296 + uFR_SAM_GetDesfireUidAesAuth @3297 + uFR_SAM_GetDesfireUidAesAuthM @3298 + uFR_SAM_GetDesfireUidDesAuth @3299 + uFR_SAM_GetDesfireUidDesAuthM @3300 + uFR_SAM_GetDesfireUidHnd @3301 + uFR_find_first_FTDI_device @3302 + uFR_i_block_transceive @3303 + uFR_i_block_transceiveM @3304 + uFR_int_DesfireChange2K3DesKey_2k3des @3305 + uFR_int_DesfireChange2K3DesKey_2k3desM @3306 + uFR_int_DesfireChange2K3DesKey_2k3des_PK @3307 + uFR_int_DesfireChange2K3DesKey_2k3des_PK_M @3308 + uFR_int_DesfireChange2K3DesKey_des @3309 + uFR_int_DesfireChange2K3DesKey_desM @3310 + uFR_int_DesfireChange2K3DesKey_des_PK @3311 + uFR_int_DesfireChange2K3DesKey_des_PK_M @3312 + uFR_int_DesfireChange3K3DesKey_3k3des @3313 + uFR_int_DesfireChange3K3DesKey_3k3desM @3314 + uFR_int_DesfireChange3K3DesKey_3k3des_PK @3315 + uFR_int_DesfireChange3K3DesKey_3k3des_PK_M @3316 + uFR_int_DesfireChangeAesKey @3317 + uFR_int_DesfireChangeAesKeyHnd @3318 + uFR_int_DesfireChangeAesKeyM @3319 + uFR_int_DesfireChangeAesKey_A @3320 + uFR_int_DesfireChangeAesKey_PK @3321 + uFR_int_DesfireChangeAesKey_PK_M @3322 + uFR_int_DesfireChangeAesKey_aes @3323 + uFR_int_DesfireChangeAesKey_aesM @3324 + uFR_int_DesfireChangeAesKey_aes_PK @3325 + uFR_int_DesfireChangeAesKey_aes_PK_M @3326 + uFR_int_DesfireChangeDesKey_2k3des @3327 + uFR_int_DesfireChangeDesKey_2k3desM @3328 + uFR_int_DesfireChangeDesKey_2k3des_PK @3329 + uFR_int_DesfireChangeDesKey_2k3des_PK_M @3330 + uFR_int_DesfireChangeDesKey_des @3331 + uFR_int_DesfireChangeDesKey_desM @3332 + uFR_int_DesfireChangeDesKey_des_PK @3333 + uFR_int_DesfireChangeDesKey_des_PK_M @3334 + uFR_int_DesfireChangeFileSettingsHnd @3335 + uFR_int_DesfireChangeFileSettingsSdm @3336 + uFR_int_DesfireChangeFileSettingsSdmHnd @3337 + uFR_int_DesfireChangeFileSettingsSdmM @3338 + uFR_int_DesfireChangeFileSettingsSdm_PK @3339 + uFR_int_DesfireChangeFileSettingsSdm_PK_M @3340 + uFR_int_DesfireChangeFileSettings_2k3des @3341 + uFR_int_DesfireChangeFileSettings_2k3desHnd @3342 + uFR_int_DesfireChangeFileSettings_2k3desM @3343 + uFR_int_DesfireChangeFileSettings_2k3des_PK @3344 + uFR_int_DesfireChangeFileSettings_2k3des_PK_M @3345 + uFR_int_DesfireChangeFileSettings_3k3des @3346 + uFR_int_DesfireChangeFileSettings_3k3desHnd @3347 + uFR_int_DesfireChangeFileSettings_3k3desM @3348 + uFR_int_DesfireChangeFileSettings_3k3des_PK @3349 + uFR_int_DesfireChangeFileSettings_3k3des_PK_M @3350 + uFR_int_DesfireChangeFileSettings_aes @3351 + uFR_int_DesfireChangeFileSettings_aesM @3352 + uFR_int_DesfireChangeFileSettings_aes_PK @3353 + uFR_int_DesfireChangeFileSettings_aes_PK_M @3354 + uFR_int_DesfireChangeFileSettings_des @3355 + uFR_int_DesfireChangeFileSettings_desHnd @3356 + uFR_int_DesfireChangeFileSettings_desM @3357 + uFR_int_DesfireChangeFileSettings_des_PK @3358 + uFR_int_DesfireChangeFileSettings_des_PK_M @3359 + uFR_int_DesfireChangeKeyHnd @3360 + uFR_int_DesfireChangeKeySettings @3361 + uFR_int_DesfireChangeKeySettingsHnd @3362 + uFR_int_DesfireChangeKeySettingsM @3363 + uFR_int_DesfireChangeKeySettings_2k3des @3364 + uFR_int_DesfireChangeKeySettings_2k3desHnd @3365 + uFR_int_DesfireChangeKeySettings_2k3desM @3366 + uFR_int_DesfireChangeKeySettings_2k3des_PK @3367 + uFR_int_DesfireChangeKeySettings_2k3des_PK_M @3368 + uFR_int_DesfireChangeKeySettings_3k3des @3369 + uFR_int_DesfireChangeKeySettings_3k3desHnd @3370 + uFR_int_DesfireChangeKeySettings_3k3desM @3371 + uFR_int_DesfireChangeKeySettings_3k3des_PK @3372 + uFR_int_DesfireChangeKeySettings_3k3des_PK_M @3373 + uFR_int_DesfireChangeKeySettings_PK @3374 + uFR_int_DesfireChangeKeySettings_PK_M @3375 + uFR_int_DesfireChangeKeySettings_aes @3376 + uFR_int_DesfireChangeKeySettings_aesM @3377 + uFR_int_DesfireChangeKeySettings_aes_PK @3378 + uFR_int_DesfireChangeKeySettings_aes_PK_M @3379 + uFR_int_DesfireChangeKeySettings_des @3380 + uFR_int_DesfireChangeKeySettings_desHnd @3381 + uFR_int_DesfireChangeKeySettings_desM @3382 + uFR_int_DesfireChangeKeySettings_des_PK @3383 + uFR_int_DesfireChangeKeySettings_des_PK_M @3384 + uFR_int_DesfireChangeMasterKey @3385 + uFR_int_DesfireChangeMasterKeyM @3386 + uFR_int_DesfireChangeMasterKey_PK @3387 + uFR_int_DesfireChangeMasterKey_PK_M @3388 + uFR_int_DesfireClearRecordFile @3389 + uFR_int_DesfireClearRecordFile_2k3des @3390 + uFR_int_DesfireClearRecordFile_2k3desM @3391 + uFR_int_DesfireClearRecordFile_2k3des_2 @3392 + uFR_int_DesfireClearRecordFile_2k3des_2M @3393 + uFR_int_DesfireClearRecordFile_2k3des_PK @3394 + uFR_int_DesfireClearRecordFile_2k3des_PK_2 @3395 + uFR_int_DesfireClearRecordFile_2k3des_PK_2M @3396 + uFR_int_DesfireClearRecordFile_2k3des_PK_M @3397 + uFR_int_DesfireClearRecordFile_3k3des @3398 + uFR_int_DesfireClearRecordFile_3k3desM @3399 + uFR_int_DesfireClearRecordFile_3k3des_2 @3400 + uFR_int_DesfireClearRecordFile_3k3des_2M @3401 + uFR_int_DesfireClearRecordFile_3k3des_PK @3402 + uFR_int_DesfireClearRecordFile_3k3des_PK_2 @3403 + uFR_int_DesfireClearRecordFile_3k3des_PK_2M @3404 + uFR_int_DesfireClearRecordFile_3k3des_PK_M @3405 + uFR_int_DesfireClearRecordFile_PK @3406 + uFR_int_DesfireClearRecordFile_PK_2 @3407 + uFR_int_DesfireClearRecordFile_TransMac_2k3des @3408 + uFR_int_DesfireClearRecordFile_TransMac_2k3desM @3409 + uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK @3410 + uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M @3411 + uFR_int_DesfireClearRecordFile_TransMac_3k3des @3412 + uFR_int_DesfireClearRecordFile_TransMac_3k3desM @3413 + uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK @3414 + uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M @3415 + uFR_int_DesfireClearRecordFile_TransMac_aes @3416 + uFR_int_DesfireClearRecordFile_TransMac_aesM @3417 + uFR_int_DesfireClearRecordFile_TransMac_aes_PK @3418 + uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M @3419 + uFR_int_DesfireClearRecordFile_TransMac_des @3420 + uFR_int_DesfireClearRecordFile_TransMac_desM @3421 + uFR_int_DesfireClearRecordFile_TransMac_des_PK @3422 + uFR_int_DesfireClearRecordFile_TransMac_des_PK_M @3423 + uFR_int_DesfireClearRecordFile_TransMac_no_auth @3424 + uFR_int_DesfireClearRecordFile_TransMac_no_auth_M @3425 + uFR_int_DesfireClearRecordFile_aes @3426 + uFR_int_DesfireClearRecordFile_aesM @3427 + uFR_int_DesfireClearRecordFile_aes_2 @3428 + uFR_int_DesfireClearRecordFile_aes_2M @3429 + uFR_int_DesfireClearRecordFile_aes_PK @3430 + uFR_int_DesfireClearRecordFile_aes_PK_2 @3431 + uFR_int_DesfireClearRecordFile_aes_PK_2M @3432 + uFR_int_DesfireClearRecordFile_aes_PK_M @3433 + uFR_int_DesfireClearRecordFile_des @3434 + uFR_int_DesfireClearRecordFile_desM @3435 + uFR_int_DesfireClearRecordFile_des_2 @3436 + uFR_int_DesfireClearRecordFile_des_2M @3437 + uFR_int_DesfireClearRecordFile_des_PK @3438 + uFR_int_DesfireClearRecordFile_des_PK_2 @3439 + uFR_int_DesfireClearRecordFile_des_PK_2M @3440 + uFR_int_DesfireClearRecordFile_des_PK_M @3441 + uFR_int_DesfireClearRecordFile_no_auth @3442 + uFR_int_DesfireClearRecordFile_no_authM @3443 + uFR_int_DesfireClearRecordHnd @3444 + uFR_int_DesfireClearRecord_2k3desHnd @3445 + uFR_int_DesfireClearRecord_3k3desHnd @3446 + uFR_int_DesfireClearRecord_desHnd @3447 + uFR_int_DesfireCreate3k3desApplication_2k3des @3448 + uFR_int_DesfireCreate3k3desApplication_2k3desM @3449 + uFR_int_DesfireCreate3k3desApplication_2k3des_PK @3450 + uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M @3451 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso @3452 + uFR_int_DesfireCreate3k3desApplication_2k3des_isoM @3453 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK @3454 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M @3455 + uFR_int_DesfireCreate3k3desApplication_3k3des @3456 + uFR_int_DesfireCreate3k3desApplication_3k3desM @3457 + uFR_int_DesfireCreate3k3desApplication_3k3des_PK @3458 + uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M @3459 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso @3460 + uFR_int_DesfireCreate3k3desApplication_3k3des_isoM @3461 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK @3462 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M @3463 + uFR_int_DesfireCreate3k3desApplication_aes @3464 + uFR_int_DesfireCreate3k3desApplication_aesM @3465 + uFR_int_DesfireCreate3k3desApplication_aes_PK @3466 + uFR_int_DesfireCreate3k3desApplication_aes_PK_M @3467 + uFR_int_DesfireCreate3k3desApplication_aes_iso @3468 + uFR_int_DesfireCreate3k3desApplication_aes_isoM @3469 + uFR_int_DesfireCreate3k3desApplication_aes_iso_PK @3470 + uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M @3471 + uFR_int_DesfireCreate3k3desApplication_des @3472 + uFR_int_DesfireCreate3k3desApplication_desM @3473 + uFR_int_DesfireCreate3k3desApplication_des_PK @3474 + uFR_int_DesfireCreate3k3desApplication_des_PK_M @3475 + uFR_int_DesfireCreate3k3desApplication_des_iso @3476 + uFR_int_DesfireCreate3k3desApplication_des_isoM @3477 + uFR_int_DesfireCreate3k3desApplication_des_iso_PK @3478 + uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M @3479 + uFR_int_DesfireCreate3k3desApplication_no_auth @3480 + uFR_int_DesfireCreate3k3desApplication_no_auth_M @3481 + uFR_int_DesfireCreate3k3desApplication_no_auth_iso @3482 + uFR_int_DesfireCreate3k3desApplication_no_auth_isoM @3483 + uFR_int_DesfireCreateAesApplication @3484 + uFR_int_DesfireCreateAesApplicationHnd @3485 + uFR_int_DesfireCreateAesApplicationM @3486 + uFR_int_DesfireCreateAesApplication_2k3des @3487 + uFR_int_DesfireCreateAesApplication_2k3desM @3488 + uFR_int_DesfireCreateAesApplication_2k3des_PK @3489 + uFR_int_DesfireCreateAesApplication_2k3des_PK_M @3490 + uFR_int_DesfireCreateAesApplication_2k3des_iso @3491 + uFR_int_DesfireCreateAesApplication_2k3des_isoM @3492 + uFR_int_DesfireCreateAesApplication_2k3des_iso_PK @3493 + uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M @3494 + uFR_int_DesfireCreateAesApplication_3k3des @3495 + uFR_int_DesfireCreateAesApplication_3k3desM @3496 + uFR_int_DesfireCreateAesApplication_3k3des_PK @3497 + uFR_int_DesfireCreateAesApplication_3k3des_PK_M @3498 + uFR_int_DesfireCreateAesApplication_3k3des_iso @3499 + uFR_int_DesfireCreateAesApplication_3k3des_isoM @3500 + uFR_int_DesfireCreateAesApplication_3k3des_iso_PK @3501 + uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M @3502 + uFR_int_DesfireCreateAesApplication_PK @3503 + uFR_int_DesfireCreateAesApplication_PK_M @3504 + uFR_int_DesfireCreateAesApplication_aes @3505 + uFR_int_DesfireCreateAesApplication_aesM @3506 + uFR_int_DesfireCreateAesApplication_aes_PK @3507 + uFR_int_DesfireCreateAesApplication_aes_PK_M @3508 + uFR_int_DesfireCreateAesApplication_aes_iso @3509 + uFR_int_DesfireCreateAesApplication_aes_isoM @3510 + uFR_int_DesfireCreateAesApplication_aes_iso_PK @3511 + uFR_int_DesfireCreateAesApplication_aes_iso_PK_M @3512 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd @3513 + uFR_int_DesfireCreateAesApplication_aes_iso_ascdM @3514 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK @3515 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M @3516 + uFR_int_DesfireCreateAesApplication_des @3517 + uFR_int_DesfireCreateAesApplication_desM @3518 + uFR_int_DesfireCreateAesApplication_des_PK @3519 + uFR_int_DesfireCreateAesApplication_des_PK_M @3520 + uFR_int_DesfireCreateAesApplication_des_iso @3521 + uFR_int_DesfireCreateAesApplication_des_isoM @3522 + uFR_int_DesfireCreateAesApplication_des_iso_PK @3523 + uFR_int_DesfireCreateAesApplication_des_iso_PK_M @3524 + uFR_int_DesfireCreateAesApplication_iso_Hnd @3525 + uFR_int_DesfireCreateAesApplication_iso_ascd_Hnd @3526 + uFR_int_DesfireCreateAesApplication_no_auth @3527 + uFR_int_DesfireCreateAesApplication_no_auth_M @3528 + uFR_int_DesfireCreateAesApplication_no_auth_iso @3529 + uFR_int_DesfireCreateAesApplication_no_auth_isoM @3530 + uFR_int_DesfireCreateApplication_2k3des_Hnd @3531 + uFR_int_DesfireCreateApplication_2k3des_iso_Hnd @3532 + uFR_int_DesfireCreateApplication_3k3des_Hnd @3533 + uFR_int_DesfireCreateApplication_3k3des_iso_Hnd @3534 + uFR_int_DesfireCreateApplication_des_Hnd @3535 + uFR_int_DesfireCreateApplication_des_iso_Hnd @3536 + uFR_int_DesfireCreateBackupDataFile_2k3des @3537 + uFR_int_DesfireCreateBackupDataFile_2k3desM @3538 + uFR_int_DesfireCreateBackupDataFile_2k3des_Hnd @3539 + uFR_int_DesfireCreateBackupDataFile_2k3des_PK @3540 + uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M @3541 + uFR_int_DesfireCreateBackupDataFile_3k3des @3542 + uFR_int_DesfireCreateBackupDataFile_3k3desM @3543 + uFR_int_DesfireCreateBackupDataFile_3k3des_Hnd @3544 + uFR_int_DesfireCreateBackupDataFile_3k3des_PK @3545 + uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M @3546 + uFR_int_DesfireCreateBackupDataFile_PK @3547 + uFR_int_DesfireCreateBackupDataFile_aes @3548 + uFR_int_DesfireCreateBackupDataFile_aesM @3549 + uFR_int_DesfireCreateBackupDataFile_aes_Hnd @3550 + uFR_int_DesfireCreateBackupDataFile_aes_PK @3551 + uFR_int_DesfireCreateBackupDataFile_aes_PK_M @3552 + uFR_int_DesfireCreateBackupDataFile_des @3553 + uFR_int_DesfireCreateBackupDataFile_desM @3554 + uFR_int_DesfireCreateBackupDataFile_des_Hnd @3555 + uFR_int_DesfireCreateBackupDataFile_des_PK @3556 + uFR_int_DesfireCreateBackupDataFile_des_PK_M @3557 + uFR_int_DesfireCreateBackupDataFile_no_auth @3558 + uFR_int_DesfireCreateBackupDataFile_no_auth_M @3559 + uFR_int_DesfireCreateCyclicRecordFile_2k3des @3560 + uFR_int_DesfireCreateCyclicRecordFile_2k3desM @3561 + uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK @3562 + uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M @3563 + uFR_int_DesfireCreateCyclicRecordFile_3k3des @3564 + uFR_int_DesfireCreateCyclicRecordFile_3k3desM @3565 + uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK @3566 + uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M @3567 + uFR_int_DesfireCreateCyclicRecordFile_aes @3568 + uFR_int_DesfireCreateCyclicRecordFile_aesM @3569 + uFR_int_DesfireCreateCyclicRecordFile_aes_PK @3570 + uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M @3571 + uFR_int_DesfireCreateCyclicRecordFile_des @3572 + uFR_int_DesfireCreateCyclicRecordFile_desM @3573 + uFR_int_DesfireCreateCyclicRecordFile_des_PK @3574 + uFR_int_DesfireCreateCyclicRecordFile_des_PK_M @3575 + uFR_int_DesfireCreateCyclicRecordFile_no_auth @3576 + uFR_int_DesfireCreateCyclicRecordFile_no_authM @3577 + uFR_int_DesfireCreateDesApplication_2k3des @3578 + uFR_int_DesfireCreateDesApplication_2k3desM @3579 + uFR_int_DesfireCreateDesApplication_2k3des_PK @3580 + uFR_int_DesfireCreateDesApplication_2k3des_PK_M @3581 + uFR_int_DesfireCreateDesApplication_2k3des_iso @3582 + uFR_int_DesfireCreateDesApplication_2k3des_isoM @3583 + uFR_int_DesfireCreateDesApplication_2k3des_iso_PK @3584 + uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M @3585 + uFR_int_DesfireCreateDesApplication_3k3des @3586 + uFR_int_DesfireCreateDesApplication_3k3desM @3587 + uFR_int_DesfireCreateDesApplication_3k3des_PK @3588 + uFR_int_DesfireCreateDesApplication_3k3des_PK_M @3589 + uFR_int_DesfireCreateDesApplication_3k3des_iso @3590 + uFR_int_DesfireCreateDesApplication_3k3des_isoM @3591 + uFR_int_DesfireCreateDesApplication_3k3des_iso_PK @3592 + uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M @3593 + uFR_int_DesfireCreateDesApplication_aes @3594 + uFR_int_DesfireCreateDesApplication_aesM @3595 + uFR_int_DesfireCreateDesApplication_aes_PK @3596 + uFR_int_DesfireCreateDesApplication_aes_PK_M @3597 + uFR_int_DesfireCreateDesApplication_aes_iso @3598 + uFR_int_DesfireCreateDesApplication_aes_isoM @3599 + uFR_int_DesfireCreateDesApplication_aes_iso_PK @3600 + uFR_int_DesfireCreateDesApplication_aes_iso_PK_M @3601 + uFR_int_DesfireCreateDesApplication_des @3602 + uFR_int_DesfireCreateDesApplication_desM @3603 + uFR_int_DesfireCreateDesApplication_des_PK @3604 + uFR_int_DesfireCreateDesApplication_des_PK_M @3605 + uFR_int_DesfireCreateDesApplication_des_iso @3606 + uFR_int_DesfireCreateDesApplication_des_isoM @3607 + uFR_int_DesfireCreateDesApplication_des_iso_PK @3608 + uFR_int_DesfireCreateDesApplication_des_iso_PK_M @3609 + uFR_int_DesfireCreateDesApplication_no_auth @3610 + uFR_int_DesfireCreateDesApplication_no_auth_M @3611 + uFR_int_DesfireCreateDesApplication_no_auth_iso @3612 + uFR_int_DesfireCreateDesApplication_no_auth_isoM @3613 + uFR_int_DesfireCreateLinearRecordFile_2k3des @3614 + uFR_int_DesfireCreateLinearRecordFile_2k3desM @3615 + uFR_int_DesfireCreateLinearRecordFile_2k3des_PK @3616 + uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M @3617 + uFR_int_DesfireCreateLinearRecordFile_3k3des @3618 + uFR_int_DesfireCreateLinearRecordFile_3k3desM @3619 + uFR_int_DesfireCreateLinearRecordFile_3k3des_PK @3620 + uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M @3621 + uFR_int_DesfireCreateLinearRecordFile_aes @3622 + uFR_int_DesfireCreateLinearRecordFile_aesM @3623 + uFR_int_DesfireCreateLinearRecordFile_aes_PK @3624 + uFR_int_DesfireCreateLinearRecordFile_aes_PK_M @3625 + uFR_int_DesfireCreateLinearRecordFile_des @3626 + uFR_int_DesfireCreateLinearRecordFile_desM @3627 + uFR_int_DesfireCreateLinearRecordFile_des_PK @3628 + uFR_int_DesfireCreateLinearRecordFile_des_PK_M @3629 + uFR_int_DesfireCreateLinearRecordFile_no_auth @3630 + uFR_int_DesfireCreateLinearRecordFile_no_authM @3631 + uFR_int_DesfireCreateRecordFileHnd @3632 + uFR_int_DesfireCreateRecordFile_2k3desHnd @3633 + uFR_int_DesfireCreateRecordFile_3k3desHnd @3634 + uFR_int_DesfireCreateRecordFile_desHnd @3635 + uFR_int_DesfireCreateStdDataFile @3636 + uFR_int_DesfireCreateStdDataFileHnd @3637 + uFR_int_DesfireCreateStdDataFileM @3638 + uFR_int_DesfireCreateStdDataFile_2k3des @3639 + uFR_int_DesfireCreateStdDataFile_2k3desM @3640 + uFR_int_DesfireCreateStdDataFile_2k3des_Hnd @3641 + uFR_int_DesfireCreateStdDataFile_2k3des_PK @3642 + uFR_int_DesfireCreateStdDataFile_2k3des_PK_M @3643 + uFR_int_DesfireCreateStdDataFile_2k3des_iso @3644 + uFR_int_DesfireCreateStdDataFile_2k3des_isoM @3645 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_Hnd @3646 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK @3647 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M @3648 + uFR_int_DesfireCreateStdDataFile_3k3des @3649 + uFR_int_DesfireCreateStdDataFile_3k3desM @3650 + uFR_int_DesfireCreateStdDataFile_3k3des_Hnd @3651 + uFR_int_DesfireCreateStdDataFile_3k3des_PK @3652 + uFR_int_DesfireCreateStdDataFile_3k3des_PK_M @3653 + uFR_int_DesfireCreateStdDataFile_3k3des_iso @3654 + uFR_int_DesfireCreateStdDataFile_3k3des_isoM @3655 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_Hnd @3656 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK @3657 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M @3658 + uFR_int_DesfireCreateStdDataFile_PK @3659 + uFR_int_DesfireCreateStdDataFile_PK_M @3660 + uFR_int_DesfireCreateStdDataFile_aes @3661 + uFR_int_DesfireCreateStdDataFile_aesM @3662 + uFR_int_DesfireCreateStdDataFile_aes_PK @3663 + uFR_int_DesfireCreateStdDataFile_aes_PK_M @3664 + uFR_int_DesfireCreateStdDataFile_aes_iso @3665 + uFR_int_DesfireCreateStdDataFile_aes_isoM @3666 + uFR_int_DesfireCreateStdDataFile_aes_iso_PK @3667 + uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M @3668 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm @3669 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM @3670 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK @3671 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M @3672 + uFR_int_DesfireCreateStdDataFile_des @3673 + uFR_int_DesfireCreateStdDataFile_desM @3674 + uFR_int_DesfireCreateStdDataFile_des_Hnd @3675 + uFR_int_DesfireCreateStdDataFile_des_PK @3676 + uFR_int_DesfireCreateStdDataFile_des_PK_M @3677 + uFR_int_DesfireCreateStdDataFile_des_iso @3678 + uFR_int_DesfireCreateStdDataFile_des_isoM @3679 + uFR_int_DesfireCreateStdDataFile_des_iso_Hnd @3680 + uFR_int_DesfireCreateStdDataFile_des_iso_PK @3681 + uFR_int_DesfireCreateStdDataFile_des_iso_PK_M @3682 + uFR_int_DesfireCreateStdDataFile_iso_Hnd @3683 + uFR_int_DesfireCreateStdDataFile_iso_sdm_Hnd @3684 + uFR_int_DesfireCreateStdDataFile_no_auth @3685 + uFR_int_DesfireCreateStdDataFile_no_auth_M @3686 + uFR_int_DesfireCreateStdDataFile_no_auth_iso @3687 + uFR_int_DesfireCreateStdDataFile_no_auth_isoM @3688 + uFR_int_DesfireCreateTransMacFileHnd @3689 + uFR_int_DesfireCreateTransMacFile_2k3des @3690 + uFR_int_DesfireCreateTransMacFile_2k3des_Hnd @3691 + uFR_int_DesfireCreateTransMacFile_2k3des_M @3692 + uFR_int_DesfireCreateTransMacFile_2k3des_PK @3693 + uFR_int_DesfireCreateTransMacFile_2k3des_PK_M @3694 + uFR_int_DesfireCreateTransMacFile_3k3des @3695 + uFR_int_DesfireCreateTransMacFile_3k3des_Hnd @3696 + uFR_int_DesfireCreateTransMacFile_3k3des_M @3697 + uFR_int_DesfireCreateTransMacFile_3k3des_PK @3698 + uFR_int_DesfireCreateTransMacFile_3k3des_PK_M @3699 + uFR_int_DesfireCreateTransMacFile_aes @3700 + uFR_int_DesfireCreateTransMacFile_aes_M @3701 + uFR_int_DesfireCreateTransMacFile_aes_PK @3702 + uFR_int_DesfireCreateTransMacFile_aes_PK_M @3703 + uFR_int_DesfireCreateTransMacFile_des @3704 + uFR_int_DesfireCreateTransMacFile_des_Hnd @3705 + uFR_int_DesfireCreateTransMacFile_des_M @3706 + uFR_int_DesfireCreateTransMacFile_des_PK @3707 + uFR_int_DesfireCreateTransMacFile_des_PK_M @3708 + uFR_int_DesfireCreateValueFile @3709 + uFR_int_DesfireCreateValueFileHnd @3710 + uFR_int_DesfireCreateValueFileM @3711 + uFR_int_DesfireCreateValueFile_2k3des @3712 + uFR_int_DesfireCreateValueFile_2k3desHnd @3713 + uFR_int_DesfireCreateValueFile_2k3desM @3714 + uFR_int_DesfireCreateValueFile_2k3des_PK @3715 + uFR_int_DesfireCreateValueFile_2k3des_PK_M @3716 + uFR_int_DesfireCreateValueFile_3k3des @3717 + uFR_int_DesfireCreateValueFile_3k3desHnd @3718 + uFR_int_DesfireCreateValueFile_3k3desM @3719 + uFR_int_DesfireCreateValueFile_3k3des_PK @3720 + uFR_int_DesfireCreateValueFile_3k3des_PK_M @3721 + uFR_int_DesfireCreateValueFile_PK @3722 + uFR_int_DesfireCreateValueFile_PK_M @3723 + uFR_int_DesfireCreateValueFile_aes @3724 + uFR_int_DesfireCreateValueFile_aesM @3725 + uFR_int_DesfireCreateValueFile_aes_PK @3726 + uFR_int_DesfireCreateValueFile_aes_PK_M @3727 + uFR_int_DesfireCreateValueFile_des @3728 + uFR_int_DesfireCreateValueFile_desHnd @3729 + uFR_int_DesfireCreateValueFile_desM @3730 + uFR_int_DesfireCreateValueFile_des_PK @3731 + uFR_int_DesfireCreateValueFile_des_PK_M @3732 + uFR_int_DesfireCreateValueFile_no_auth @3733 + uFR_int_DesfireCreateValueFile_no_auth_M @3734 + uFR_int_DesfireDecreaseValueFile @3735 + uFR_int_DesfireDecreaseValueFileHnd @3736 + uFR_int_DesfireDecreaseValueFileM @3737 + uFR_int_DesfireDecreaseValueFile_2k3des @3738 + uFR_int_DesfireDecreaseValueFile_2k3desHnd @3739 + uFR_int_DesfireDecreaseValueFile_2k3desM @3740 + uFR_int_DesfireDecreaseValueFile_2k3des_PK @3741 + uFR_int_DesfireDecreaseValueFile_2k3des_PK_M @3742 + uFR_int_DesfireDecreaseValueFile_3k3des @3743 + uFR_int_DesfireDecreaseValueFile_3k3desHnd @3744 + uFR_int_DesfireDecreaseValueFile_3k3desM @3745 + uFR_int_DesfireDecreaseValueFile_3k3des_PK @3746 + uFR_int_DesfireDecreaseValueFile_3k3des_PK_M @3747 + uFR_int_DesfireDecreaseValueFile_PK @3748 + uFR_int_DesfireDecreaseValueFile_PK_M @3749 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des @3750 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM @3751 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK @3752 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M @3753 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des @3754 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM @3755 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK @3756 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M @3757 + uFR_int_DesfireDecreaseValueFile_TransMac_aes @3758 + uFR_int_DesfireDecreaseValueFile_TransMac_aesM @3759 + uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK @3760 + uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M @3761 + uFR_int_DesfireDecreaseValueFile_TransMac_des @3762 + uFR_int_DesfireDecreaseValueFile_TransMac_desM @3763 + uFR_int_DesfireDecreaseValueFile_TransMac_des_PK @3764 + uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M @3765 + uFR_int_DesfireDecreaseValueFile_TransMac_no_auth @3766 + uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M @3767 + uFR_int_DesfireDecreaseValueFile_aes @3768 + uFR_int_DesfireDecreaseValueFile_aesM @3769 + uFR_int_DesfireDecreaseValueFile_aes_PK @3770 + uFR_int_DesfireDecreaseValueFile_aes_PK_M @3771 + uFR_int_DesfireDecreaseValueFile_des @3772 + uFR_int_DesfireDecreaseValueFile_desHnd @3773 + uFR_int_DesfireDecreaseValueFile_desM @3774 + uFR_int_DesfireDecreaseValueFile_des_PK @3775 + uFR_int_DesfireDecreaseValueFile_des_PK_M @3776 + uFR_int_DesfireDecreaseValueFile_no_auth @3777 + uFR_int_DesfireDecreaseValueFile_no_auth_M @3778 + uFR_int_DesfireDeleteApplication @3779 + uFR_int_DesfireDeleteApplicationHnd @3780 + uFR_int_DesfireDeleteApplicationM @3781 + uFR_int_DesfireDeleteApplication_2k3des @3782 + uFR_int_DesfireDeleteApplication_2k3desHnd @3783 + uFR_int_DesfireDeleteApplication_2k3desM @3784 + uFR_int_DesfireDeleteApplication_2k3des_PK @3785 + uFR_int_DesfireDeleteApplication_2k3des_PK_M @3786 + uFR_int_DesfireDeleteApplication_3k3des @3787 + uFR_int_DesfireDeleteApplication_3k3desHnd @3788 + uFR_int_DesfireDeleteApplication_3k3desM @3789 + uFR_int_DesfireDeleteApplication_3k3des_PK @3790 + uFR_int_DesfireDeleteApplication_3k3des_PK_M @3791 + uFR_int_DesfireDeleteApplication_PK @3792 + uFR_int_DesfireDeleteApplication_PK_M @3793 + uFR_int_DesfireDeleteApplication_aes @3794 + uFR_int_DesfireDeleteApplication_aesM @3795 + uFR_int_DesfireDeleteApplication_aes_PK @3796 + uFR_int_DesfireDeleteApplication_aes_PK_M @3797 + uFR_int_DesfireDeleteApplication_app_master_2k3des @3798 + uFR_int_DesfireDeleteApplication_app_master_2k3desM @3799 + uFR_int_DesfireDeleteApplication_app_master_2k3des_PK @3800 + uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M @3801 + uFR_int_DesfireDeleteApplication_app_master_3k3des @3802 + uFR_int_DesfireDeleteApplication_app_master_3k3desM @3803 + uFR_int_DesfireDeleteApplication_app_master_3k3des_PK @3804 + uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M @3805 + uFR_int_DesfireDeleteApplication_app_master_PK @3806 + uFR_int_DesfireDeleteApplication_app_master_aes @3807 + uFR_int_DesfireDeleteApplication_app_master_aesM @3808 + uFR_int_DesfireDeleteApplication_app_master_aes_PK @3809 + uFR_int_DesfireDeleteApplication_app_master_aes_PK_M @3810 + uFR_int_DesfireDeleteApplication_app_master_des @3811 + uFR_int_DesfireDeleteApplication_app_master_desM @3812 + uFR_int_DesfireDeleteApplication_app_master_des_PK @3813 + uFR_int_DesfireDeleteApplication_app_master_des_PK_M @3814 + uFR_int_DesfireDeleteApplication_des @3815 + uFR_int_DesfireDeleteApplication_desHnd @3816 + uFR_int_DesfireDeleteApplication_desM @3817 + uFR_int_DesfireDeleteApplication_des_PK @3818 + uFR_int_DesfireDeleteApplication_des_PK_M @3819 + uFR_int_DesfireDeleteFile @3820 + uFR_int_DesfireDeleteFileHnd @3821 + uFR_int_DesfireDeleteFileM @3822 + uFR_int_DesfireDeleteFile_2k3des @3823 + uFR_int_DesfireDeleteFile_2k3desHnd @3824 + uFR_int_DesfireDeleteFile_2k3desM @3825 + uFR_int_DesfireDeleteFile_2k3des_PK @3826 + uFR_int_DesfireDeleteFile_2k3des_PK_M @3827 + uFR_int_DesfireDeleteFile_3k3des @3828 + uFR_int_DesfireDeleteFile_3k3desHnd @3829 + uFR_int_DesfireDeleteFile_3k3desM @3830 + uFR_int_DesfireDeleteFile_3k3des_PK @3831 + uFR_int_DesfireDeleteFile_3k3des_PK_M @3832 + uFR_int_DesfireDeleteFile_PK @3833 + uFR_int_DesfireDeleteFile_PK_M @3834 + uFR_int_DesfireDeleteFile_aes @3835 + uFR_int_DesfireDeleteFile_aesM @3836 + uFR_int_DesfireDeleteFile_aes_PK @3837 + uFR_int_DesfireDeleteFile_aes_PK_M @3838 + uFR_int_DesfireDeleteFile_des @3839 + uFR_int_DesfireDeleteFile_desHnd @3840 + uFR_int_DesfireDeleteFile_desM @3841 + uFR_int_DesfireDeleteFile_des_PK @3842 + uFR_int_DesfireDeleteFile_des_PK_M @3843 + uFR_int_DesfireDeleteFile_no_auth @3844 + uFR_int_DesfireDeleteFile_no_auth_M @3845 + uFR_int_DesfireFormatCard @3846 + uFR_int_DesfireFormatCardHnd @3847 + uFR_int_DesfireFormatCardM @3848 + uFR_int_DesfireFormatCard_2k3des @3849 + uFR_int_DesfireFormatCard_2k3desHnd @3850 + uFR_int_DesfireFormatCard_2k3desM @3851 + uFR_int_DesfireFormatCard_2k3des_PK @3852 + uFR_int_DesfireFormatCard_2k3des_PK_M @3853 + uFR_int_DesfireFormatCard_3k3des @3854 + uFR_int_DesfireFormatCard_3k3desHnd @3855 + uFR_int_DesfireFormatCard_3k3desM @3856 + uFR_int_DesfireFormatCard_3k3des_PK @3857 + uFR_int_DesfireFormatCard_3k3des_PK_M @3858 + uFR_int_DesfireFormatCard_PK @3859 + uFR_int_DesfireFormatCard_PK_M @3860 + uFR_int_DesfireFormatCard_aes @3861 + uFR_int_DesfireFormatCard_aesM @3862 + uFR_int_DesfireFormatCard_aes_PK @3863 + uFR_int_DesfireFormatCard_aes_PK_M @3864 + uFR_int_DesfireFormatCard_des @3865 + uFR_int_DesfireFormatCard_desHnd @3866 + uFR_int_DesfireFormatCard_desM @3867 + uFR_int_DesfireFormatCard_des_PK @3868 + uFR_int_DesfireFormatCard_des_PK_M @3869 + uFR_int_DesfireFreeMem @3870 + uFR_int_DesfireFreeMemHnd @3871 + uFR_int_DesfireFreeMemM @3872 + uFR_int_DesfireGetApplicationIds @3873 + uFR_int_DesfireGetApplicationIdsHnd @3874 + uFR_int_DesfireGetApplicationIdsM @3875 + uFR_int_DesfireGetApplicationIds_2k3des @3876 + uFR_int_DesfireGetApplicationIds_2k3desHnd @3877 + uFR_int_DesfireGetApplicationIds_2k3desM @3878 + uFR_int_DesfireGetApplicationIds_2k3des_PK @3879 + uFR_int_DesfireGetApplicationIds_2k3des_PK_M @3880 + uFR_int_DesfireGetApplicationIds_3k3des @3881 + uFR_int_DesfireGetApplicationIds_3k3desHnd @3882 + uFR_int_DesfireGetApplicationIds_3k3desM @3883 + uFR_int_DesfireGetApplicationIds_3k3des_PK @3884 + uFR_int_DesfireGetApplicationIds_3k3des_PK_M @3885 + uFR_int_DesfireGetApplicationIds_PK @3886 + uFR_int_DesfireGetApplicationIds_PK_M @3887 + uFR_int_DesfireGetApplicationIds_aes @3888 + uFR_int_DesfireGetApplicationIds_aesM @3889 + uFR_int_DesfireGetApplicationIds_aes_PK @3890 + uFR_int_DesfireGetApplicationIds_aes_PK_M @3891 + uFR_int_DesfireGetApplicationIds_des @3892 + uFR_int_DesfireGetApplicationIds_desHnd @3893 + uFR_int_DesfireGetApplicationIds_desM @3894 + uFR_int_DesfireGetApplicationIds_des_PK @3895 + uFR_int_DesfireGetApplicationIds_des_PK_M @3896 + uFR_int_DesfireGetApplicationIds_no_auth @3897 + uFR_int_DesfireGetApplicationIds_no_auth_M @3898 + uFR_int_DesfireGetFileSettingsHnd @3899 + uFR_int_DesfireGetFileSettingsSdmHnd @3900 + uFR_int_DesfireGetFileSettingsSdm_aes @3901 + uFR_int_DesfireGetFileSettingsSdm_aes_M @3902 + uFR_int_DesfireGetFileSettingsSdm_aes_PK @3903 + uFR_int_DesfireGetFileSettingsSdm_aes_PK_M @3904 + uFR_int_DesfireGetFileSettings_2k3des @3905 + uFR_int_DesfireGetFileSettings_2k3desHnd @3906 + uFR_int_DesfireGetFileSettings_2k3des_M @3907 + uFR_int_DesfireGetFileSettings_2k3des_PK @3908 + uFR_int_DesfireGetFileSettings_2k3des_PK_M @3909 + uFR_int_DesfireGetFileSettings_3k3des @3910 + uFR_int_DesfireGetFileSettings_3k3desHnd @3911 + uFR_int_DesfireGetFileSettings_3k3des_M @3912 + uFR_int_DesfireGetFileSettings_3k3des_PK @3913 + uFR_int_DesfireGetFileSettings_3k3des_PK_M @3914 + uFR_int_DesfireGetFileSettings_aes @3915 + uFR_int_DesfireGetFileSettings_aes_M @3916 + uFR_int_DesfireGetFileSettings_aes_PK @3917 + uFR_int_DesfireGetFileSettings_aes_PK_M @3918 + uFR_int_DesfireGetFileSettings_des @3919 + uFR_int_DesfireGetFileSettings_desHnd @3920 + uFR_int_DesfireGetFileSettings_des_M @3921 + uFR_int_DesfireGetFileSettings_des_PK @3922 + uFR_int_DesfireGetFileSettings_des_PK_M @3923 + uFR_int_DesfireGetFileSettings_no_auth @3924 + uFR_int_DesfireGetFileSettings_no_auth_M @3925 + uFR_int_DesfireGetKeySettings @3926 + uFR_int_DesfireGetKeySettingsHnd @3927 + uFR_int_DesfireGetKeySettingsM @3928 + uFR_int_DesfireGetKeySettings_2k3des @3929 + uFR_int_DesfireGetKeySettings_2k3desHnd @3930 + uFR_int_DesfireGetKeySettings_2k3desM @3931 + uFR_int_DesfireGetKeySettings_2k3des_PK @3932 + uFR_int_DesfireGetKeySettings_2k3des_PK_M @3933 + uFR_int_DesfireGetKeySettings_3k3des @3934 + uFR_int_DesfireGetKeySettings_3k3desHnd @3935 + uFR_int_DesfireGetKeySettings_3k3desM @3936 + uFR_int_DesfireGetKeySettings_3k3des_PK @3937 + uFR_int_DesfireGetKeySettings_3k3des_PK_M @3938 + uFR_int_DesfireGetKeySettings_PK @3939 + uFR_int_DesfireGetKeySettings_PK_M @3940 + uFR_int_DesfireGetKeySettings_aes @3941 + uFR_int_DesfireGetKeySettings_aesM @3942 + uFR_int_DesfireGetKeySettings_aes_PK @3943 + uFR_int_DesfireGetKeySettings_aes_PK_M @3944 + uFR_int_DesfireGetKeySettings_des @3945 + uFR_int_DesfireGetKeySettings_desHnd @3946 + uFR_int_DesfireGetKeySettings_desM @3947 + uFR_int_DesfireGetKeySettings_des_PK @3948 + uFR_int_DesfireGetKeySettings_des_PK_M @3949 + uFR_int_DesfireGetKeySettings_no_auth @3950 + uFR_int_DesfireGetKeySettings_no_auth_M @3951 + uFR_int_DesfireGetStdFileSize_2k3des @3952 + uFR_int_DesfireGetStdFileSize_2k3des_M @3953 + uFR_int_DesfireGetStdFileSize_2k3des_PK @3954 + uFR_int_DesfireGetStdFileSize_2k3des_PK_M @3955 + uFR_int_DesfireGetStdFileSize_3k3des @3956 + uFR_int_DesfireGetStdFileSize_3k3des_M @3957 + uFR_int_DesfireGetStdFileSize_3k3des_PK @3958 + uFR_int_DesfireGetStdFileSize_3k3des_PK_M @3959 + uFR_int_DesfireGetStdFileSize_aes @3960 + uFR_int_DesfireGetStdFileSize_aes_M @3961 + uFR_int_DesfireGetStdFileSize_aes_PK @3962 + uFR_int_DesfireGetStdFileSize_aes_PK_M @3963 + uFR_int_DesfireGetStdFileSize_des @3964 + uFR_int_DesfireGetStdFileSize_des_M @3965 + uFR_int_DesfireGetStdFileSize_des_PK @3966 + uFR_int_DesfireGetStdFileSize_des_PK_M @3967 + uFR_int_DesfireGetStdFileSize_no_auth @3968 + uFR_int_DesfireGetStdFileSize_no_auth_M @3969 + uFR_int_DesfireIncreaseValueFile @3970 + uFR_int_DesfireIncreaseValueFileHnd @3971 + uFR_int_DesfireIncreaseValueFileM @3972 + uFR_int_DesfireIncreaseValueFile_2k3des @3973 + uFR_int_DesfireIncreaseValueFile_2k3desHnd @3974 + uFR_int_DesfireIncreaseValueFile_2k3desM @3975 + uFR_int_DesfireIncreaseValueFile_2k3des_PK @3976 + uFR_int_DesfireIncreaseValueFile_2k3des_PK_M @3977 + uFR_int_DesfireIncreaseValueFile_3k3des @3978 + uFR_int_DesfireIncreaseValueFile_3k3desHnd @3979 + uFR_int_DesfireIncreaseValueFile_3k3desM @3980 + uFR_int_DesfireIncreaseValueFile_3k3des_PK @3981 + uFR_int_DesfireIncreaseValueFile_3k3des_PK_M @3982 + uFR_int_DesfireIncreaseValueFile_PK @3983 + uFR_int_DesfireIncreaseValueFile_PK_M @3984 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des @3985 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM @3986 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK @3987 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M @3988 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des @3989 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM @3990 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK @3991 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M @3992 + uFR_int_DesfireIncreaseValueFile_TransMac_aes @3993 + uFR_int_DesfireIncreaseValueFile_TransMac_aesM @3994 + uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK @3995 + uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M @3996 + uFR_int_DesfireIncreaseValueFile_TransMac_des @3997 + uFR_int_DesfireIncreaseValueFile_TransMac_desM @3998 + uFR_int_DesfireIncreaseValueFile_TransMac_des_PK @3999 + uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M @4000 + uFR_int_DesfireIncreaseValueFile_TransMac_no_auth @4001 + uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M @4002 + uFR_int_DesfireIncreaseValueFile_aes @4003 + uFR_int_DesfireIncreaseValueFile_aesM @4004 + uFR_int_DesfireIncreaseValueFile_aes_PK @4005 + uFR_int_DesfireIncreaseValueFile_aes_PK_M @4006 + uFR_int_DesfireIncreaseValueFile_des @4007 + uFR_int_DesfireIncreaseValueFile_desHnd @4008 + uFR_int_DesfireIncreaseValueFile_desM @4009 + uFR_int_DesfireIncreaseValueFile_des_PK @4010 + uFR_int_DesfireIncreaseValueFile_des_PK_M @4011 + uFR_int_DesfireIncreaseValueFile_no_auth @4012 + uFR_int_DesfireIncreaseValueFile_no_auth_M @4013 + uFR_int_DesfireNDEFFormat @4014 + uFR_int_DesfireNDEFFormatHnd @4015 + uFR_int_DesfireReadNDEFMessage @4016 + uFR_int_DesfireReadNDEFMessageHnd @4017 + uFR_int_DesfireReadNDEFPayload @4018 + uFR_int_DesfireReadNDEFPayloadHnd @4019 + uFR_int_DesfireReadRecordsHnd @4020 + uFR_int_DesfireReadRecords_2k3des @4021 + uFR_int_DesfireReadRecords_2k3desHnd @4022 + uFR_int_DesfireReadRecords_2k3desM @4023 + uFR_int_DesfireReadRecords_2k3des_PK @4024 + uFR_int_DesfireReadRecords_2k3des_PK_M @4025 + uFR_int_DesfireReadRecords_3k3des @4026 + uFR_int_DesfireReadRecords_3k3desHnd @4027 + uFR_int_DesfireReadRecords_3k3desM @4028 + uFR_int_DesfireReadRecords_3k3des_PK @4029 + uFR_int_DesfireReadRecords_3k3des_PK_M @4030 + uFR_int_DesfireReadRecords_aes @4031 + uFR_int_DesfireReadRecords_aesM @4032 + uFR_int_DesfireReadRecords_aes_PK @4033 + uFR_int_DesfireReadRecords_aes_PK_M @4034 + uFR_int_DesfireReadRecords_des @4035 + uFR_int_DesfireReadRecords_desHnd @4036 + uFR_int_DesfireReadRecords_desM @4037 + uFR_int_DesfireReadRecords_des_PK @4038 + uFR_int_DesfireReadRecords_des_PK_M @4039 + uFR_int_DesfireReadRecords_no_auth @4040 + uFR_int_DesfireReadRecords_no_authM @4041 + uFR_int_DesfireReadStdDataFile @4042 + uFR_int_DesfireReadStdDataFileHnd @4043 + uFR_int_DesfireReadStdDataFile_2k3des @4044 + uFR_int_DesfireReadStdDataFile_2k3desHnd @4045 + uFR_int_DesfireReadStdDataFile_2k3desM @4046 + uFR_int_DesfireReadStdDataFile_2k3des_PK @4047 + uFR_int_DesfireReadStdDataFile_2k3des_PK_M @4048 + uFR_int_DesfireReadStdDataFile_3k3des @4049 + uFR_int_DesfireReadStdDataFile_3k3desHnd @4050 + uFR_int_DesfireReadStdDataFile_3k3desM @4051 + uFR_int_DesfireReadStdDataFile_3k3des_PK @4052 + uFR_int_DesfireReadStdDataFile_3k3des_PK_M @4053 + uFR_int_DesfireReadStdDataFile_PK @4054 + uFR_int_DesfireReadStdDataFile_PK_M @4055 + uFR_int_DesfireReadStdDataFile_aes @4056 + uFR_int_DesfireReadStdDataFile_aesM @4057 + uFR_int_DesfireReadStdDataFile_aes_PK @4058 + uFR_int_DesfireReadStdDataFile_aes_PK_M @4059 + uFR_int_DesfireReadStdDataFile_des @4060 + uFR_int_DesfireReadStdDataFile_desHnd @4061 + uFR_int_DesfireReadStdDataFile_desM @4062 + uFR_int_DesfireReadStdDataFile_des_PK @4063 + uFR_int_DesfireReadStdDataFile_des_PK_M @4064 + uFR_int_DesfireReadStdDataFile_no_auth @4065 + uFR_int_DesfireReadStdDataFile_no_auth_M @4066 + uFR_int_DesfireReadStddDataFileM @4067 + uFR_int_DesfireReadStddDataFile_aesM @4068 + uFR_int_DesfireReadValueFile @4069 + uFR_int_DesfireReadValueFileHnd @4070 + uFR_int_DesfireReadValueFileM @4071 + uFR_int_DesfireReadValueFile_2k3des @4072 + uFR_int_DesfireReadValueFile_2k3desHnd @4073 + uFR_int_DesfireReadValueFile_2k3desM @4074 + uFR_int_DesfireReadValueFile_2k3des_PK @4075 + uFR_int_DesfireReadValueFile_2k3des_PK_M @4076 + uFR_int_DesfireReadValueFile_3k3des @4077 + uFR_int_DesfireReadValueFile_3k3desHnd @4078 + uFR_int_DesfireReadValueFile_3k3desM @4079 + uFR_int_DesfireReadValueFile_3k3des_PK @4080 + uFR_int_DesfireReadValueFile_3k3des_PK_M @4081 + uFR_int_DesfireReadValueFile_PK @4082 + uFR_int_DesfireReadValueFile_PK_M @4083 + uFR_int_DesfireReadValueFile_aes @4084 + uFR_int_DesfireReadValueFile_aesM @4085 + uFR_int_DesfireReadValueFile_aes_PK @4086 + uFR_int_DesfireReadValueFile_aes_PK_M @4087 + uFR_int_DesfireReadValueFile_des @4088 + uFR_int_DesfireReadValueFile_desHnd @4089 + uFR_int_DesfireReadValueFile_desM @4090 + uFR_int_DesfireReadValueFile_des_PK @4091 + uFR_int_DesfireReadValueFile_des_PK_M @4092 + uFR_int_DesfireReadValueFile_no_auth @4093 + uFR_int_DesfireReadValueFile_no_auth_M @4094 + uFR_int_DesfireRidReadECCSignature_2k3des @4095 + uFR_int_DesfireRidReadECCSignature_2k3desM @4096 + uFR_int_DesfireRidReadECCSignature_2k3des_PK @4097 + uFR_int_DesfireRidReadECCSignature_2k3des_PK_M @4098 + uFR_int_DesfireRidReadECCSignature_3k3des @4099 + uFR_int_DesfireRidReadECCSignature_3k3desM @4100 + uFR_int_DesfireRidReadECCSignature_3k3des_PK @4101 + uFR_int_DesfireRidReadECCSignature_3k3des_PK_M @4102 + uFR_int_DesfireRidReadECCSignature_aes @4103 + uFR_int_DesfireRidReadECCSignature_aesM @4104 + uFR_int_DesfireRidReadECCSignature_aes_PK @4105 + uFR_int_DesfireRidReadECCSignature_aes_PK_M @4106 + uFR_int_DesfireRidReadECCSignature_des @4107 + uFR_int_DesfireRidReadECCSignature_desM @4108 + uFR_int_DesfireRidReadECCSignature_des_PK @4109 + uFR_int_DesfireRidReadECCSignature_des_PK_M @4110 + uFR_int_DesfireSetConfiguration @4111 + uFR_int_DesfireSetConfigurationExHnd @4112 + uFR_int_DesfireSetConfigurationHnd @4113 + uFR_int_DesfireSetConfigurationM @4114 + uFR_int_DesfireSetConfiguration_2k3des @4115 + uFR_int_DesfireSetConfiguration_2k3desHnd @4116 + uFR_int_DesfireSetConfiguration_2k3desM @4117 + uFR_int_DesfireSetConfiguration_2k3des_PK @4118 + uFR_int_DesfireSetConfiguration_2k3des_PK_M @4119 + uFR_int_DesfireSetConfiguration_3k3des @4120 + uFR_int_DesfireSetConfiguration_3k3desHnd @4121 + uFR_int_DesfireSetConfiguration_3k3desM @4122 + uFR_int_DesfireSetConfiguration_3k3des_PK @4123 + uFR_int_DesfireSetConfiguration_3k3des_PK_M @4124 + uFR_int_DesfireSetConfiguration_PK @4125 + uFR_int_DesfireSetConfiguration_PK_M @4126 + uFR_int_DesfireSetConfiguration_aes @4127 + uFR_int_DesfireSetConfiguration_aesM @4128 + uFR_int_DesfireSetConfiguration_aes_PK @4129 + uFR_int_DesfireSetConfiguration_aes_PK_M @4130 + uFR_int_DesfireSetConfiguration_des @4131 + uFR_int_DesfireSetConfiguration_desHnd @4132 + uFR_int_DesfireSetConfiguration_desM @4133 + uFR_int_DesfireSetConfiguration_des_PK @4134 + uFR_int_DesfireSetConfiguration_des_PK_M @4135 + uFR_int_DesfireSetTransactionTimer_aes @4136 + uFR_int_DesfireSetTransactionTimer_aesM @4137 + uFR_int_DesfireSetTransactionTimer_aes_PK @4138 + uFR_int_DesfireSetTransactionTimer_aes_PK_M @4139 + uFR_int_DesfireUidReadECCSignature @4140 + uFR_int_DesfireUidReadECCSignatureM @4141 + uFR_int_DesfireWriteAesKey @4142 + uFR_int_DesfireWriteAesKeyHnd @4143 + uFR_int_DesfireWriteAesKeyM @4144 + uFR_int_DesfireWriteBackupDataFile_2k3des @4145 + uFR_int_DesfireWriteBackupDataFile_2k3desHnd @4146 + uFR_int_DesfireWriteBackupDataFile_2k3desM @4147 + uFR_int_DesfireWriteBackupDataFile_2k3des_PK @4148 + uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M @4149 + uFR_int_DesfireWriteBackupDataFile_3k3des @4150 + uFR_int_DesfireWriteBackupDataFile_3k3desHnd @4151 + uFR_int_DesfireWriteBackupDataFile_3k3desM @4152 + uFR_int_DesfireWriteBackupDataFile_3k3des_PK @4153 + uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M @4154 + uFR_int_DesfireWriteBackupDataFile_aes @4155 + uFR_int_DesfireWriteBackupDataFile_aesM @4156 + uFR_int_DesfireWriteBackupDataFile_aes_Hnd @4157 + uFR_int_DesfireWriteBackupDataFile_aes_PK @4158 + uFR_int_DesfireWriteBackupDataFile_aes_PK_M @4159 + uFR_int_DesfireWriteBackupDataFile_des @4160 + uFR_int_DesfireWriteBackupDataFile_desHnd @4161 + uFR_int_DesfireWriteBackupDataFile_desM @4162 + uFR_int_DesfireWriteBackupDataFile_des_PK @4163 + uFR_int_DesfireWriteBackupDataFile_des_PK_M @4164 + uFR_int_DesfireWriteBackupDataFile_no_auth @4165 + uFR_int_DesfireWriteBackupDataFile_no_auth_M @4166 + uFR_int_DesfireWriteKey @4167 + uFR_int_DesfireWriteKeyHnd @4168 + uFR_int_DesfireWriteKeyM @4169 + uFR_int_DesfireWriteNDEFMessage @4170 + uFR_int_DesfireWriteNDEFMessageHnd @4171 + uFR_int_DesfireWriteNDEFPayload @4172 + uFR_int_DesfireWriteNDEFPayloadHnd @4173 + uFR_int_DesfireWriteRecordHnd @4174 + uFR_int_DesfireWriteRecord_2k3des @4175 + uFR_int_DesfireWriteRecord_2k3desHnd @4176 + uFR_int_DesfireWriteRecord_2k3desM @4177 + uFR_int_DesfireWriteRecord_2k3des_PK @4178 + uFR_int_DesfireWriteRecord_2k3des_PK_M @4179 + uFR_int_DesfireWriteRecord_3k3des @4180 + uFR_int_DesfireWriteRecord_3k3desHnd @4181 + uFR_int_DesfireWriteRecord_3k3desM @4182 + uFR_int_DesfireWriteRecord_3k3des_PK @4183 + uFR_int_DesfireWriteRecord_3k3des_PK_M @4184 + uFR_int_DesfireWriteRecord_TransMac_2k3des @4185 + uFR_int_DesfireWriteRecord_TransMac_2k3desM @4186 + uFR_int_DesfireWriteRecord_TransMac_2k3des_PK @4187 + uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M @4188 + uFR_int_DesfireWriteRecord_TransMac_3k3des @4189 + uFR_int_DesfireWriteRecord_TransMac_3k3desM @4190 + uFR_int_DesfireWriteRecord_TransMac_3k3des_PK @4191 + uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M @4192 + uFR_int_DesfireWriteRecord_TransMac_aes @4193 + uFR_int_DesfireWriteRecord_TransMac_aesM @4194 + uFR_int_DesfireWriteRecord_TransMac_aes_PK @4195 + uFR_int_DesfireWriteRecord_TransMac_aes_PK_M @4196 + uFR_int_DesfireWriteRecord_TransMac_des @4197 + uFR_int_DesfireWriteRecord_TransMac_desM @4198 + uFR_int_DesfireWriteRecord_TransMac_des_PK @4199 + uFR_int_DesfireWriteRecord_TransMac_des_PK_M @4200 + uFR_int_DesfireWriteRecord_TransMac_no_auth @4201 + uFR_int_DesfireWriteRecord_TransMac_no_auth_M @4202 + uFR_int_DesfireWriteRecord_aes @4203 + uFR_int_DesfireWriteRecord_aesM @4204 + uFR_int_DesfireWriteRecord_aes_PK @4205 + uFR_int_DesfireWriteRecord_aes_PK_M @4206 + uFR_int_DesfireWriteRecord_des @4207 + uFR_int_DesfireWriteRecord_desHnd @4208 + uFR_int_DesfireWriteRecord_desM @4209 + uFR_int_DesfireWriteRecord_des_PK @4210 + uFR_int_DesfireWriteRecord_des_PK_M @4211 + uFR_int_DesfireWriteRecord_no_auth @4212 + uFR_int_DesfireWriteRecord_no_authM @4213 + uFR_int_DesfireWriteStdDataFile @4214 + uFR_int_DesfireWriteStdDataFileHnd @4215 + uFR_int_DesfireWriteStdDataFileM @4216 + uFR_int_DesfireWriteStdDataFile_2k3des @4217 + uFR_int_DesfireWriteStdDataFile_2k3desHnd @4218 + uFR_int_DesfireWriteStdDataFile_2k3desM @4219 + uFR_int_DesfireWriteStdDataFile_2k3des_PK @4220 + uFR_int_DesfireWriteStdDataFile_2k3des_PK_M @4221 + uFR_int_DesfireWriteStdDataFile_3k3des @4222 + uFR_int_DesfireWriteStdDataFile_3k3desHnd @4223 + uFR_int_DesfireWriteStdDataFile_3k3desM @4224 + uFR_int_DesfireWriteStdDataFile_3k3des_PK @4225 + uFR_int_DesfireWriteStdDataFile_3k3des_PK_M @4226 + uFR_int_DesfireWriteStdDataFile_PK @4227 + uFR_int_DesfireWriteStdDataFile_PK_M @4228 + uFR_int_DesfireWriteStdDataFile_aes @4229 + uFR_int_DesfireWriteStdDataFile_aesM @4230 + uFR_int_DesfireWriteStdDataFile_aes_PK @4231 + uFR_int_DesfireWriteStdDataFile_aes_PK_M @4232 + uFR_int_DesfireWriteStdDataFile_des @4233 + uFR_int_DesfireWriteStdDataFile_desHnd @4234 + uFR_int_DesfireWriteStdDataFile_desM @4235 + uFR_int_DesfireWriteStdDataFile_des_PK @4236 + uFR_int_DesfireWriteStdDataFile_des_PK_M @4237 + uFR_int_DesfireWriteStdDataFile_no_auth @4238 + uFR_int_DesfireWriteStdDataFile_no_auth_M @4239 + uFR_int_GetDesfireUid @4240 + uFR_int_GetDesfireUidHnd @4241 + uFR_int_GetDesfireUidM @4242 + uFR_int_GetDesfireUid_2k3des @4243 + uFR_int_GetDesfireUid_2k3desHnd @4244 + uFR_int_GetDesfireUid_2k3desM @4245 + uFR_int_GetDesfireUid_2k3des_PK @4246 + uFR_int_GetDesfireUid_2k3des_PK_M @4247 + uFR_int_GetDesfireUid_3k3des @4248 + uFR_int_GetDesfireUid_3k3desHnd @4249 + uFR_int_GetDesfireUid_3k3desM @4250 + uFR_int_GetDesfireUid_3k3des_PK @4251 + uFR_int_GetDesfireUid_3k3des_PK_M @4252 + uFR_int_GetDesfireUid_PK @4253 + uFR_int_GetDesfireUid_PK_M @4254 + uFR_int_GetDesfireUid_aes @4255 + uFR_int_GetDesfireUid_aesM @4256 + uFR_int_GetDesfireUid_aes_PK @4257 + uFR_int_GetDesfireUid_aes_PK_M @4258 + uFR_int_GetDesfireUid_des @4259 + uFR_int_GetDesfireUid_desHnd @4260 + uFR_int_GetDesfireUid_desM @4261 + uFR_int_GetDesfireUid_des_PK @4262 + uFR_int_GetDesfireUid_des_PK_M @4263 + uFR_mifare_desfire_aes_key_new_with_version @4264 + uFR_mifare_desfire_des_key_new @4265 + uFR_mifare_desfire_key_free @4266 + uFR_mifare_desfire_tag_free @4267 + uFR_mifare_desfire_tag_new @4268 + uart_transceive @4269 + uart_transceiveHnd @4270 + uart_transceiveM @4271 + udp_close @4272 + udp_init @4273 + udp_purge @4274 + udp_reader_list @4275 + udp_rx @4276 + udp_set_timeout_ms @4277 + udp_tx @4278 + ufr_handle_init @4279 + ufr_sleep @4280 + uid_list_size @4281 DATA + ul_ev1_publickey_str @4282 DATA + uncompress @4283 + uncompress2 @4284 + unit_check_available @4285 + unit_delete_if_not_opened @4286 + unpackBytes @4287 + validate_TD1_format @4288 + validate_TD3_format @4289 + validate_certificate @4290 + warnx @4291 + win_frequency @4292 DATA + write_ndef_record @4293 + write_ndef_recordHnd @4294 + write_ndef_recordM @4295 + write_ndef_record_mirroring @4296 + write_ndef_record_mirroringHnd @4297 + write_ndef_record_mirroringM @4298 + write_ndef_record_mirroring_tt @4299 + write_ndef_record_mirroring_ttM @4300 + x509GetSignatureNodePos @4301 + x509_decode_public_key_from_certificate @4302 + x509_decode_subject_public_key_info @4303 + zError @4304 + z_errmsg @4305 DATA + zcalloc @4306 + zcfree @4307 + zeromem @4308 + zlibCompileFlags @4309 + zlibVersion @4310 diff --git a/ufr-lib/windows/aarch64/uFCoder-aarch64.dll b/ufr-lib/windows/aarch64/uFCoder-aarch64.dll new file mode 100644 index 0000000..9306a8a Binary files /dev/null and b/ufr-lib/windows/aarch64/uFCoder-aarch64.dll differ diff --git a/ufr-lib/windows/static-x86/ftd2xx_coff.lib b/ufr-lib/windows/static-x86/ftd2xx_coff.lib new file mode 100644 index 0000000..5dc71ee Binary files /dev/null and b/ufr-lib/windows/static-x86/ftd2xx_coff.lib differ diff --git a/ufr-lib/windows/static-x86/libuFCoder-x86.a b/ufr-lib/windows/static-x86/libuFCoder-x86.a new file mode 100644 index 0000000..426fcbd Binary files /dev/null and b/ufr-lib/windows/static-x86/libuFCoder-x86.a differ diff --git a/ufr-lib/windows/static-x86/readme.txt b/ufr-lib/windows/static-x86/readme.txt new file mode 100644 index 0000000..414fd5e --- /dev/null +++ b/ufr-lib/windows/static-x86/readme.txt @@ -0,0 +1,8 @@ +When you use uFCoder static library, you must define DL_USE_STATIC_LIB macro before including the uFCoder.h + +After uFR-library version 4.4.1 an additional library [ws2_32.lib] must be included to support UDP transfer protocol +#pragma comment(lib, "ws2_32.lib") + +Additionally, linkage to "ftd2xx_coff.lib" is mandatory. + +As of version 6.0.6, linking with "-lsetupapi" flag is mandatory as well. \ No newline at end of file diff --git a/ufr-lib/windows/static-x86_64/ftd2xx_coff_x64.lib b/ufr-lib/windows/static-x86_64/ftd2xx_coff_x64.lib new file mode 100644 index 0000000..7b28fab Binary files /dev/null and b/ufr-lib/windows/static-x86_64/ftd2xx_coff_x64.lib differ diff --git a/ufr-lib/windows/static-x86_64/libuFCoder-x86_64.a b/ufr-lib/windows/static-x86_64/libuFCoder-x86_64.a new file mode 100644 index 0000000..54117ea Binary files /dev/null and b/ufr-lib/windows/static-x86_64/libuFCoder-x86_64.a differ diff --git a/ufr-lib/windows/static-x86_64/readme.txt b/ufr-lib/windows/static-x86_64/readme.txt new file mode 100644 index 0000000..f01349e --- /dev/null +++ b/ufr-lib/windows/static-x86_64/readme.txt @@ -0,0 +1,8 @@ +When you use uFCoder static library, you must define DL_USE_STATIC_LIB macro before including the uFCoder.h + +After uFR-library version 4.4.1 an additional library [ws2_32.lib] must be included to support UDP transfer protocol +#pragma comment(lib, "ws2_32.lib") + +Additionally, linkage to "ftd2xx_coff_x64.lib" is mandatory. + +As of version 6.0.6, linking with "-lsetupapi" flag is mandatory as well. diff --git a/ufr-lib/windows/uwp/uFCoder-arm.dll b/ufr-lib/windows/uwp/uFCoder-arm.dll new file mode 100644 index 0000000..349c593 Binary files /dev/null and b/ufr-lib/windows/uwp/uFCoder-arm.dll differ diff --git a/ufr-lib/windows/uwp/uFCoder-arm.lib b/ufr-lib/windows/uwp/uFCoder-arm.lib new file mode 100644 index 0000000..6a96727 Binary files /dev/null and b/ufr-lib/windows/uwp/uFCoder-arm.lib differ diff --git a/ufr-lib/windows/uwp/uFCoder-x86.dll b/ufr-lib/windows/uwp/uFCoder-x86.dll new file mode 100644 index 0000000..a79ca4c Binary files /dev/null and b/ufr-lib/windows/uwp/uFCoder-x86.dll differ diff --git a/ufr-lib/windows/uwp/uFCoder-x86.lib b/ufr-lib/windows/uwp/uFCoder-x86.lib new file mode 100644 index 0000000..3be9128 Binary files /dev/null and b/ufr-lib/windows/uwp/uFCoder-x86.lib differ diff --git a/ufr-lib/windows/uwp/uFCoder-x86_64.dll b/ufr-lib/windows/uwp/uFCoder-x86_64.dll new file mode 100644 index 0000000..8f8349c Binary files /dev/null and b/ufr-lib/windows/uwp/uFCoder-x86_64.dll differ diff --git a/ufr-lib/windows/uwp/uFCoder-x86_64.lib b/ufr-lib/windows/uwp/uFCoder-x86_64.lib new file mode 100644 index 0000000..bc3dc56 Binary files /dev/null and b/ufr-lib/windows/uwp/uFCoder-x86_64.lib differ diff --git a/ufr-lib/windows/uwp/uwp-serial-arm.dll b/ufr-lib/windows/uwp/uwp-serial-arm.dll new file mode 100644 index 0000000..8821621 Binary files /dev/null and b/ufr-lib/windows/uwp/uwp-serial-arm.dll differ diff --git a/ufr-lib/windows/uwp/uwp-serial-arm.lib b/ufr-lib/windows/uwp/uwp-serial-arm.lib new file mode 100644 index 0000000..ffe168f Binary files /dev/null and b/ufr-lib/windows/uwp/uwp-serial-arm.lib differ diff --git a/ufr-lib/windows/uwp/uwp-serial-x86.dll b/ufr-lib/windows/uwp/uwp-serial-x86.dll new file mode 100644 index 0000000..816ff4a Binary files /dev/null and b/ufr-lib/windows/uwp/uwp-serial-x86.dll differ diff --git a/ufr-lib/windows/uwp/uwp-serial-x86.lib b/ufr-lib/windows/uwp/uwp-serial-x86.lib new file mode 100644 index 0000000..ed19e6f Binary files /dev/null and b/ufr-lib/windows/uwp/uwp-serial-x86.lib differ diff --git a/ufr-lib/windows/uwp/uwp-serial-x86_64.dll b/ufr-lib/windows/uwp/uwp-serial-x86_64.dll new file mode 100644 index 0000000..325a1b6 Binary files /dev/null and b/ufr-lib/windows/uwp/uwp-serial-x86_64.dll differ diff --git a/ufr-lib/windows/uwp/uwp-serial-x86_64.lib b/ufr-lib/windows/uwp/uwp-serial-x86_64.lib new file mode 100644 index 0000000..5d911d3 Binary files /dev/null and b/ufr-lib/windows/uwp/uwp-serial-x86_64.lib differ diff --git a/ufr-lib/windows/x86/COMuFCoder-x86.dll b/ufr-lib/windows/x86/COMuFCoder-x86.dll new file mode 100644 index 0000000..d7b8827 Binary files /dev/null and b/ufr-lib/windows/x86/COMuFCoder-x86.dll differ diff --git a/ufr-lib/windows/x86/COMuFCoder-x86.tlb b/ufr-lib/windows/x86/COMuFCoder-x86.tlb new file mode 100644 index 0000000..0a67140 Binary files /dev/null and b/ufr-lib/windows/x86/COMuFCoder-x86.tlb differ diff --git a/ufr-lib/windows/x86/libeay32.dll b/ufr-lib/windows/x86/libeay32.dll new file mode 100644 index 0000000..c5d13a1 Binary files /dev/null and b/ufr-lib/windows/x86/libeay32.dll differ diff --git a/ufr-lib/windows/x86/readme.md b/ufr-lib/windows/x86/readme.md new file mode 100644 index 0000000..21e883f --- /dev/null +++ b/ufr-lib/windows/x86/readme.md @@ -0,0 +1,22 @@ + +# New Feature - COM wrapper for uFCoder library + +Implemented Component Object Model wrapper for uFCoder library. + +``` +COMuFCoder-x86.dll +``` + +## How to register COM library + +``` +regasm COMuFCoder-x86.dll /codebase +``` +response: +``` +Microsoft .NET Framework Assembly Registration Utility version 4.7.3056.0 +for Microsoft .NET Framework version 4.7.3056.0 +Copyright (C) Microsoft Corporation. All rights reserved. + +Types registered successfully +``` diff --git a/ufr-lib/windows/x86/uFCoder-x86.def b/ufr-lib/windows/x86/uFCoder-x86.def new file mode 100644 index 0000000..efd6070 --- /dev/null +++ b/ufr-lib/windows/x86/uFCoder-x86.def @@ -0,0 +1,2256 @@ +EXPORTS + AES_to_DES_key_type = AES_to_DES_key_type@0 @1 + APDUHexStrTransceive = APDUHexStrTransceive@8 @2 + APDUHexStrTransceiveM = APDUHexStrTransceiveM@12 @3 + APDUPlainTransceive = APDUPlainTransceive@16 @4 + APDUPlainTransceiveM = APDUPlainTransceiveM@20 @5 + APDUPlainTransceiveToHeap = APDUPlainTransceiveToHeap@16 @6 + APDUPlainTransceiveToHeapM = APDUPlainTransceiveToHeapM@20 @7 + APDUTransceive = APDUTransceive@40 @8 + APDUTransceiveM = APDUTransceiveM@44 @9 + APDU_switch_off_from_ISO7816_interface = APDU_switch_off_from_ISO7816_interface@0 @10 + APDU_switch_off_from_ISO7816_interfaceM = APDU_switch_off_from_ISO7816_interfaceM@4 @11 + APDU_switch_to_ISO14443_4_interface = APDU_switch_to_ISO14443_4_interface@0 @12 + APDU_switch_to_ISO14443_4_interfaceM = APDU_switch_to_ISO14443_4_interfaceM@4 @13 + APDU_switch_to_ISO7816_interface = APDU_switch_to_ISO7816_interface@0 @14 + APDU_switch_to_ISO7816_interfaceM = APDU_switch_to_ISO7816_interfaceM@4 @15 + ATECC608LockConfig = ATECC608LockConfig@0 @16 + ATECC608LockConfigM = ATECC608LockConfigM@4 @17 + ATECC608LockDataAndOtp = ATECC608LockDataAndOtp@0 @18 + ATECC608LockDataAndOtpM = ATECC608LockDataAndOtpM@4 @19 + ATECC608LockKeySlot = ATECC608LockKeySlot@4 @20 + ATECC608LockKeySlotM = ATECC608LockKeySlotM@8 @21 + AdHocEmulationStart = AdHocEmulationStart@0 @22 + AdHocEmulationStartM = AdHocEmulationStartM@4 @23 + AdHocEmulationStop = AdHocEmulationStop@0 @24 + AdHocEmulationStopM = AdHocEmulationStopM@4 @25 + AutoSleepGet = AutoSleepGet@4 @26 + AutoSleepGetM = AutoSleepGetM@8 @27 + AutoSleepSet = AutoSleepSet@4 @28 + AutoSleepSetM = AutoSleepSetM@8 @29 + BalanceGet = BalanceGet@12 @30 + BalanceGetM = BalanceGetM@16 @31 + BalanceSet = BalanceSet@12 @32 + BalanceSetM = BalanceSetM@16 @33 + BlockInSectorRead = BlockInSectorRead@20 @34 + BlockInSectorReadM = BlockInSectorReadM@24 @35 + BlockInSectorReadSamKey = BlockInSectorReadSamKey@20 @36 + BlockInSectorReadSamkeyM = BlockInSectorReadSamkeyM@24 @37 + BlockInSectorRead_AKM1 = BlockInSectorRead_AKM1@16 @38 + BlockInSectorRead_AKM1M = BlockInSectorRead_AKM1M@20 @39 + BlockInSectorRead_AKM2 = BlockInSectorRead_AKM2@16 @40 + BlockInSectorRead_AKM2M = BlockInSectorRead_AKM2M@20 @41 + BlockInSectorRead_PK = BlockInSectorRead_PK@20 @42 + BlockInSectorRead_PKM = BlockInSectorRead_PKM@24 @43 + BlockInSectorWrite = BlockInSectorWrite@20 @44 + BlockInSectorWriteM = BlockInSectorWriteM@24 @45 + BlockInSectorWriteSamKey = BlockInSectorWriteSamKey@20 @46 + BlockInSectorWriteSamkeyM = BlockInSectorWriteSamkeyM@24 @47 + BlockInSectorWrite_AKM1 = BlockInSectorWrite_AKM1@16 @48 + BlockInSectorWrite_AKM1M = BlockInSectorWrite_AKM1M@20 @49 + BlockInSectorWrite_AKM2 = BlockInSectorWrite_AKM2@16 @50 + BlockInSectorWrite_AKM2M = BlockInSectorWrite_AKM2M@20 @51 + BlockInSectorWrite_PK = BlockInSectorWrite_PK@20 @52 + BlockInSectorWrite_PKM = BlockInSectorWrite_PKM@24 @53 + BlockRead = BlockRead@16 @54 + BlockReadM = BlockReadM@20 @55 + BlockReadSamKey = BlockReadSamKey@16 @56 + BlockReadSamKeyM = BlockReadSamKeyM@20 @57 + BlockRead_AKM1 = BlockRead_AKM1@12 @58 + BlockRead_AKM1M = BlockRead_AKM1M@16 @59 + BlockRead_AKM2 = BlockRead_AKM2@12 @60 + BlockRead_AKM2M = BlockRead_AKM2M@16 @61 + BlockRead_PK = BlockRead_PK@16 @62 + BlockRead_PKM = BlockRead_PKM@20 @63 + BlockWrite = BlockWrite@16 @64 + BlockWriteM = BlockWriteM@20 @65 + BlockWriteSamKey = BlockWriteSamKey@16 @66 + BlockWriteSamKeyM = BlockWriteSamKeyM@20 @67 + BlockWrite_AKM1 = BlockWrite_AKM1@12 @68 + BlockWrite_AKM1M = BlockWrite_AKM1M@16 @69 + BlockWrite_AKM2 = BlockWrite_AKM2@12 @70 + BlockWrite_AKM2M = BlockWrite_AKM2M@16 @71 + BlockWrite_PK = BlockWrite_PK@16 @72 + BlockWrite_PKM = BlockWrite_PKM@20 @73 + BootReader = BootReader@0 @74 + BusAdminCardMake = BusAdminCardMake@8 @75 + COMTransceive = COMTransceive@32 @76 + COMTransceiveM = COMTransceiveM@36 @77 + CardEncryption_GetActualCardSN = CardEncryption_GetActualCardSN@8 @78 + CardEncryption_GetActualCardSNM = CardEncryption_GetActualCardSNM@12 @79 + CardEncryption_GetJobSN = CardEncryption_GetJobSN@4 @80 + CardEncryption_GetJobSNM = CardEncryption_GetJobSNM@8 @81 + CardEncryption_GetNext = CardEncryption_GetNext@28 @82 + CardEncryption_GetNextEncryptedCard = CardEncryption_GetNextEncryptedCard@12 @83 + CardEncryption_GetNextEncryptedCardM = CardEncryption_GetNextEncryptedCardM@16 @84 + CardEncryption_GetNextM = CardEncryption_GetNextM@32 @85 + CardEncryption_GetSalterSN = CardEncryption_GetSalterSN@8 @86 + CardEncryption_GetSalterSNM = CardEncryption_GetSalterSNM@12 @87 + CardEncryption_Initialize = CardEncryption_Initialize@8 @88 + CardEncryption_InitializeM = CardEncryption_InitializeM@12 @89 + ChangeReaderJobId = ChangeReaderJobId@8 @90 + ChangeReaderJobIdM = ChangeReaderJobIdM@12 @91 + ChangeReaderPassword = ChangeReaderPassword@8 @92 + ChangeReaderPasswordM = ChangeReaderPasswordM@12 @93 + CheckUidChangeable = CheckUidChangeable@0 @94 + CheckUidChangeableM = CheckUidChangeableM@4 @95 + CombinedModeEmulationStart = CombinedModeEmulationStart@0 @96 + CombinedModeEmulationStartM = CombinedModeEmulationStartM@4 @97 + DES_to_AES_key_type = DES_to_AES_key_type@0 @98 + DLFree = DLFree@4 @99 + DLGetEccCurveName = DLGetEccCurveName@4 @100 + DLGetHash = DLGetHash@20 @101 + DLGetHashName = DLGetHashName@4 @102 + DLGetHashOutputByteLength = DLGetHashOutputByteLength@8 @103 + DLGetHashToHeap = DLGetHashToHeap@20 @104 + DLGetSignatureSchemeName = DLGetSignatureSchemeName@4 @105 + DLHashFinishChunked = DLHashFinishChunked@8 @106 + DLHashFinishChunkedToHeap = DLHashFinishChunkedToHeap@8 @107 + DLHashInitChunked = DLHashInitChunked@4 @108 + DLHashUpdateChunked = DLHashUpdateChunked@8 @109 + DL_TLS_Request = DL_TLS_Request@28 @110 + DL_TLS_SetClientCertificate = DL_TLS_SetClientCertificate@12 @111 + DL_TLS_SetClientX509PrivateKey_PEM = DL_TLS_SetClientX509PrivateKey_PEM@8 @112 + DefaultBaudrateFlashCheck = DefaultBaudrateFlashCheck@0 @113 + DefaultBaudrateFlashCheckM = DefaultBaudrateFlashCheckM@4 @114 + DeslectCard = DeslectCard@0 @115 + DeslectCardM = DeslectCardM@4 @116 + DigitalSignatureVerifyHash = DigitalSignatureVerifyHash@52 @117 + DisableAntiCollision = DisableAntiCollision@0 @118 + DisableAntiCollisionM = DisableAntiCollisionM@4 @119 + Display_EraseSection = Display_EraseSection@16 @120 + Display_PrintText = Display_PrintText@24 @121 + Display_SaveBitmapToGallery = Display_SaveBitmapToGallery@8 @122 + Display_SaveSystemBitmap = Display_SaveSystemBitmap@8 @123 + Display_ShowBitmap = Display_ShowBitmap@16 @124 + Display_ShowBitmapFromGallery = Display_ShowBitmapFromGallery@4 @125 + Display_ShowLastUnsavedImage = Display_ShowLastUnsavedImage@0 @126 + Display_ShowTime = Display_ShowTime@8 @127 + Display_Transmit = Display_Transmit@12 @128 + Display_UserInterfaceSignal = Display_UserInterfaceSignal@4 @129 + EE_Lock = EE_Lock@8 @130 + EE_Password_Change = EE_Password_Change@8 @131 + EE_Read = EE_Read@12 @132 + EE_Write = EE_Write@12 @133 + EMV_GetLastTransaction = EMV_GetLastTransaction@8 @134 + EMV_GetPAN = EMV_GetPAN@8 @135 + EnableAntiCollision = EnableAntiCollision@0 @136 + EnableAntiCollisionM = EnableAntiCollisionM@4 @137 + EnterShareRamCommMode = EnterShareRamCommMode@0 @138 + EnterShareRamCommModeM = EnterShareRamCommModeM@4 @139 + EnumCards = EnumCards@8 @140 + EnumCardsM = EnumCardsM@12 @141 + EspChangeReaderPassword = EspChangeReaderPassword@8 @142 + EspChangeReaderPasswordM = EspChangeReaderPasswordM@12 @143 + EspDisableWifi = EspDisableWifi@0 @144 + EspDisableWifiM = EspDisableWifiM@4 @145 + EspEnableWifi = EspEnableWifi@0 @146 + EspEnableWifiM = EspEnableWifiM@4 @147 + EspGetFirmwareVersion = EspGetFirmwareVersion@12 @148 + EspGetFirmwareVersionM = EspGetFirmwareVersionM@16 @149 + EspGetIOState = EspGetIOState@4 @150 + EspGetIOStateM = EspGetIOStateM@8 @151 + EspGetReaderSerialNumber = EspGetReaderSerialNumber@4 @152 + EspGetReaderSerialNumberM = EspGetReaderSerialNumberM@8 @153 + EspGetReaderTime = EspGetReaderTime@4 @154 + EspGetReaderTimeM = EspGetReaderTimeM@8 @155 + EspGetTransparentReaders = EspGetTransparentReaders@4 @156 + EspReaderEepromRead = EspReaderEepromRead@12 @157 + EspReaderEepromReadM = EspReaderEepromReadM@16 @158 + EspReaderEepromWrite = EspReaderEepromWrite@16 @159 + EspReaderEepromWriteM = EspReaderEepromWriteM@20 @160 + EspReaderReset = EspReaderReset@0 @161 + EspReaderResetM = EspReaderResetM@4 @162 + EspSetDisplayData = EspSetDisplayData@12 @163 + EspSetDisplayDataM = EspSetDisplayDataM@16 @164 + EspSetIOState = EspSetIOState@8 @165 + EspSetIOStateM = EspSetIOStateM@12 @166 + EspSetReaderTime = EspSetReaderTime@8 @167 + EspSetReaderTimeM = EspSetReaderTimeM@12 @168 + EspSetTransparentReader = EspSetTransparentReader@4 @169 + EspSetTransparentReaderM = EspSetTransparentReaderM@8 @170 + EspSetTransparentReaderSession = EspSetTransparentReaderSession@4 @171 + EspTurnOff = EspTurnOff@0 @172 + EspTurnOffM = EspTurnOffM@4 @173 + ExitShareRamCommMode = ExitShareRamCommMode@0 @174 + ExitShareRamCommModeM = ExitShareRamCommModeM@4 @175 + FastFlashCheck = FastFlashCheck@0 @176 + FastFlashCheckM = FastFlashCheckM@4 @177 + GetATECC608ConfigZone = GetATECC608ConfigZone@4 @178 + GetATECC608ConfigZoneM = GetATECC608ConfigZoneM@8 @179 + GetATECC608InfoRevision = GetATECC608InfoRevision@4 @180 + GetATECC608InfoRevisionM = GetATECC608InfoRevisionM@8 @181 + GetATECC608OtpZone = GetATECC608OtpZone@4 @182 + GetATECC608OtpZoneM = GetATECC608OtpZoneM@8 @183 + GetATECC608ZonesLockStatus = GetATECC608ZonesLockStatus@8 @184 + GetATECC608ZonesLockStatusM = GetATECC608ZonesLockStatusM@12 @185 + GetAdHocEmulationParams = GetAdHocEmulationParams@20 @186 + GetAdHocEmulationParamsM = GetAdHocEmulationParamsM@24 @187 + GetAntiCollisionStatus = GetAntiCollisionStatus@8 @188 + GetAntiCollisionStatusM = GetAntiCollisionStatusM@12 @189 + GetAsyncCardIdSendConfig = GetAsyncCardIdSendConfig@24 @190 + GetAsyncCardIdSendConfigEx = GetAsyncCardIdSendConfigEx@32 @191 + GetAsyncCardIdSendConfigExM = GetAsyncCardIdSendConfigExM@36 @192 + GetAsyncCardIdSendConfigM = GetAsyncCardIdSendConfigM@28 @193 + GetAtqaSak = GetAtqaSak@8 @194 + GetAtqaSakM = GetAtqaSakM@12 @195 + GetBuildNumber = GetBuildNumber@4 @196 + GetBuildNumberM = GetBuildNumberM@8 @197 + GetCardId = GetCardId@8 @198 + GetCardIdEx = GetCardIdEx@12 @199 + GetCardIdExM = GetCardIdExM@16 @200 + GetCardIdM = GetCardIdM@12 @201 + GetCardManufacturer = GetCardManufacturer@4 @202 + GetCardManufacturerM = GetCardManufacturerM@8 @203 + GetCardSize = GetCardSize@8 @204 + GetCardSizeM = GetCardSizeM@12 @205 + GetCustomUiConfig = GetCustomUiConfig@20 @206 + GetCustomUiConfigM = GetCustomUiConfigM@24 @207 + GetDiscoveryLoopSetup = GetDiscoveryLoopSetup@8 @208 + GetDiscoveryLoopSetupM = GetDiscoveryLoopSetupM@12 @209 + GetDisplayIntensity = GetDisplayIntensity@4 @210 + GetDisplayIntensityM = GetDisplayIntensityM@8 @211 + GetDllVersion = GetDllVersion@0 @212 + GetDllVersionStr = GetDllVersionStr@0 @213 + GetDlogicCardType = GetDlogicCardType@4 @214 + GetDlogicCardTypeM = GetDlogicCardTypeM@8 @215 + GetExternalFieldState = GetExternalFieldState@4 @216 + GetExternalFieldStateM = GetExternalFieldStateM@8 @217 + GetFtdiDriverVersion = GetFtdiDriverVersion@12 @218 + GetFtdiDriverVersionM = GetFtdiDriverVersionM@16 @219 + GetFtdiDriverVersionStr = GetFtdiDriverVersionStr@4 @220 + GetFtdiDriverVersionStrM = GetFtdiDriverVersionStrM@8 @221 + GetI2cDevicesStatus = GetI2cDevicesStatus@8 @222 + GetI2cDevicesStatusM = GetI2cDevicesStatusM@12 @223 + GetLastCardIdEx = GetLastCardIdEx@12 @224 + GetLastCardIdExM = GetLastCardIdExM@16 @225 + GetLicenseRequestData = GetLicenseRequestData@8 @226 + GetMobileAdditionalData = GetMobileAdditionalData@8 @227 + GetMobileAdditionalDataM = GetMobileAdditionalDataM@12 @228 + GetMobileUniqueIdAid = GetMobileUniqueIdAid@8 @229 + GetMobileUniqueIdAidM = GetMobileUniqueIdAidM@12 @230 + GetNfcT2TVersion = GetNfcT2TVersion@4 @231 + GetNfcT2TVersionM = GetNfcT2TVersionM@8 @232 + GetReaderDescription = GetReaderDescription@0 @233 + GetReaderDescriptionM = GetReaderDescriptionM@4 @234 + GetReaderFirmwareVersion = GetReaderFirmwareVersion@8 @235 + GetReaderFirmwareVersionM = GetReaderFirmwareVersionM@12 @236 + GetReaderHardwareVersion = GetReaderHardwareVersion@8 @237 + GetReaderHardwareVersionM = GetReaderHardwareVersionM@12 @238 + GetReaderLockStatus = GetReaderLockStatus@4 @239 + GetReaderLockStatusM = GetReaderLockStatusM@8 @240 + GetReaderParameters = GetReaderParameters@32 @241 + GetReaderParametersDefaultBaudrate = GetReaderParametersDefaultBaudrate@32 @242 + GetReaderParametersDefaultBaudrateM = GetReaderParametersDefaultBaudrateM@36 @243 + GetReaderParametersM = GetReaderParametersM@36 @244 + GetReaderParametersPN7462 = GetReaderParametersPN7462@32 @245 + GetReaderParametersPN7462_M = GetReaderParametersPN7462_M@36 @246 + GetReaderProMode = GetReaderProMode@8 @247 + GetReaderProModeM = GetReaderProModeM@12 @248 + GetReaderSerialDescription = GetReaderSerialDescription@4 @249 + GetReaderSerialDescriptionM = GetReaderSerialDescriptionM@8 @250 + GetReaderSerialNumber = GetReaderSerialNumber@4 @251 + GetReaderSerialNumberM = GetReaderSerialNumberM@8 @252 + GetReaderStatus = GetReaderStatus@16 @253 + GetReaderStatusEx = GetReaderStatusEx@8 @254 + GetReaderStatusExM = GetReaderStatusExM@12 @255 + GetReaderStatusM = GetReaderStatusM@20 @256 + GetReaderTime = GetReaderTime@4 @257 + GetReaderTimeM = GetReaderTimeM@8 @258 + GetReaderType = GetReaderType@4 @259 + GetReaderTypeM = GetReaderTypeM@8 @260 + GetRfAnalogRegistersISO14443_212 = GetRfAnalogRegistersISO14443_212@20 @261 + GetRfAnalogRegistersISO14443_212M = GetRfAnalogRegistersISO14443_212M@24 @262 + GetRfAnalogRegistersISO14443_424 = GetRfAnalogRegistersISO14443_424@20 @263 + GetRfAnalogRegistersISO14443_424M = GetRfAnalogRegistersISO14443_424M@24 @264 + GetRfAnalogRegistersTypeA = GetRfAnalogRegistersTypeA@20 @265 + GetRfAnalogRegistersTypeAM = GetRfAnalogRegistersTypeAM@24 @266 + GetRfAnalogRegistersTypeATrans = GetRfAnalogRegistersTypeATrans@40 @267 + GetRfAnalogRegistersTypeATransM = GetRfAnalogRegistersTypeATransM@44 @268 + GetRfAnalogRegistersTypeB = GetRfAnalogRegistersTypeB@20 @269 + GetRfAnalogRegistersTypeBM = GetRfAnalogRegistersTypeBM@24 @270 + GetRfAnalogRegistersTypeBTrans = GetRfAnalogRegistersTypeBTrans@36 @271 + GetRfAnalogRegistersTypeBTransM = GetRfAnalogRegistersTypeBTransM@40 @272 + GetRgbIntensity = GetRgbIntensity@4 @273 + GetRgbIntensityM = GetRgbIntensityM@8 @274 + GetServiceData = GetServiceData@4 @275 + GetServiceDataM = GetServiceDataM@8 @276 + GetSpeedParameters = GetSpeedParameters@8 @277 + GetSpeedParametersM = GetSpeedParametersM@12 @278 + GreenLedBlinkingTurnOff = GreenLedBlinkingTurnOff@0 @279 + GreenLedBlinkingTurnOffM = GreenLedBlinkingTurnOffM@4 @280 + GreenLedBlinkingTurnOn = GreenLedBlinkingTurnOn@0 @281 + GreenLedBlinkingTurnOnM = GreenLedBlinkingTurnOnM@4 @282 + IncrementCounter = IncrementCounter@8 @283 + IncrementCounterM = IncrementCounterM@12 @284 + JCAppDeleteEcKeyPair = JCAppDeleteEcKeyPair@4 @285 + JCAppDeleteEcKeyPairM = JCAppDeleteEcKeyPairM@8 @286 + JCAppDeleteRsaKeyPair = JCAppDeleteRsaKeyPair@4 @287 + JCAppDeleteRsaKeyPairM = JCAppDeleteRsaKeyPairM@8 @288 + JCAppGenerateKeyPair = JCAppGenerateKeyPair@24 @289 + JCAppGenerateKeyPairM = JCAppGenerateKeyPairM@28 @290 + JCAppGenerateSignature = JCAppGenerateSignature@36 @291 + JCAppGenerateSignatureM = JCAppGenerateSignatureM@40 @292 + JCAppGetEcKeySizeBits = JCAppGetEcKeySizeBits@12 @293 + JCAppGetEcKeySizeBitsM = JCAppGetEcKeySizeBitsM@16 @294 + JCAppGetEcPublicKey = JCAppGetEcPublicKey@56 @295 + JCAppGetEcPublicKeyM = JCAppGetEcPublicKeyM@60 @296 + JCAppGetErrorDescription = JCAppGetErrorDescription@4 @297 + JCAppGetObj = JCAppGetObj@16 @298 + JCAppGetObjId = JCAppGetObjId@16 @299 + JCAppGetObjIdM = JCAppGetObjIdM@20 @300 + JCAppGetObjM = JCAppGetObjM@20 @301 + JCAppGetObjSubject = JCAppGetObjSubject@16 @302 + JCAppGetObjSubjectM = JCAppGetObjSubjectM@20 @303 + JCAppGetPinTriesRemaining = JCAppGetPinTriesRemaining@8 @304 + JCAppGetPinTriesRemainingM = JCAppGetPinTriesRemainingM@12 @305 + JCAppGetRsaPublicKey = JCAppGetRsaPublicKey@20 @306 + JCAppGetRsaPublicKeyM = JCAppGetRsaPublicKeyM@24 @307 + JCAppGetSignature = JCAppGetSignature@8 @308 + JCAppInvalidateCert = JCAppInvalidateCert@8 @309 + JCAppInvalidateCertM = JCAppInvalidateCertM@12 @310 + JCAppLogin = JCAppLogin@12 @311 + JCAppLoginM = JCAppLoginM@16 @312 + JCAppPinChange = JCAppPinChange@12 @313 + JCAppPinChangeM = JCAppPinChangeM@16 @314 + JCAppPinDisable = JCAppPinDisable@4 @315 + JCAppPinDisableM = JCAppPinDisableM@8 @316 + JCAppPinEnable = JCAppPinEnable@4 @317 + JCAppPinEnableM = JCAppPinEnableM@8 @318 + JCAppPinUnblock = JCAppPinUnblock@12 @319 + JCAppPinUnblockM = JCAppPinUnblockM@16 @320 + JCAppPutObj = JCAppPutObj@24 @321 + JCAppPutObjM = JCAppPutObjM@28 @322 + JCAppPutObjSubject = JCAppPutObjSubject@16 @323 + JCAppPutObjSubjectM = JCAppPutObjSubjectM@20 @324 + JCAppPutPrivateKey = JCAppPutPrivateKey@24 @325 + JCAppPutPrivateKeyM = JCAppPutPrivateKeyM@28 @326 + JCAppSelectByAid = JCAppSelectByAid@12 @327 + JCAppSelectByAidM = JCAppSelectByAidM@16 @328 + JCAppSignatureBegin = JCAppSignatureBegin@32 @329 + JCAppSignatureBeginM = JCAppSignatureBeginM@36 @330 + JCAppSignatureEnd = JCAppSignatureEnd@4 @331 + JCAppSignatureEndM = JCAppSignatureEndM@8 @332 + JCAppSignatureUpdate = JCAppSignatureUpdate@8 @333 + JCAppSignatureUpdateM = JCAppSignatureUpdateM@12 @334 + JCStorageDeleteFile = JCStorageDeleteFile@4 @335 + JCStorageDeleteFileM = JCStorageDeleteFileM@8 @336 + JCStorageGetFileSize = JCStorageGetFileSize@8 @337 + JCStorageGetFileSizeM = JCStorageGetFileSizeM@12 @338 + JCStorageGetFilesListSize = JCStorageGetFilesListSize@4 @339 + JCStorageGetFilesListSizeM = JCStorageGetFilesListSizeM@8 @340 + JCStorageListFiles = JCStorageListFiles@8 @341 + JCStorageListFilesM = JCStorageListFilesM@12 @342 + JCStorageReadFile = JCStorageReadFile@12 @343 + JCStorageReadFileM = JCStorageReadFileM@16 @344 + JCStorageReadFileToFileSystem = JCStorageReadFileToFileSystem@8 @345 + JCStorageReadFileToFileSystemM = JCStorageReadFileToFileSystemM@12 @346 + JCStorageWriteFile = JCStorageWriteFile@12 @347 + JCStorageWriteFileFromFileSystem = JCStorageWriteFileFromFileSystem@8 @348 + JCStorageWriteFileFromFileSystemM = JCStorageWriteFileFromFileSystemM@12 @349 + JCStorageWriteFileM = JCStorageWriteFileM@16 @350 + LinRowRead = LinRowRead@24 @351 + LinRowReadM = LinRowReadM@28 @352 + LinRowRead_AKM1 = LinRowRead_AKM1@20 @353 + LinRowRead_AKM1M = LinRowRead_AKM1M@24 @354 + LinRowRead_AKM2 = LinRowRead_AKM2@20 @355 + LinRowRead_AKM2M = LinRowRead_AKM2M@24 @356 + LinRowRead_PK = LinRowRead_PK@24 @357 + LinRowRead_PKM = LinRowRead_PKM@28 @358 + LinearFormatCard = LinearFormatCard@32 @359 + LinearFormatCardM = LinearFormatCardM@36 @360 + LinearFormatCard_AKM1 = LinearFormatCard_AKM1@28 @361 + LinearFormatCard_AKM1M = LinearFormatCard_AKM1M@32 @362 + LinearFormatCard_AKM2 = LinearFormatCard_AKM2@28 @363 + LinearFormatCard_AKM2M = LinearFormatCard_AKM2M@32 @364 + LinearFormatCard_PK = LinearFormatCard_PK@32 @365 + LinearFormatCard_PKM = LinearFormatCard_PKM@36 @366 + LinearRead = LinearRead@24 @367 + LinearReadM = LinearReadM@28 @368 + LinearReadSamKey = LinearReadSamKey@24 @369 + LinearReadSamKeyM = LinearReadSamKeyM@28 @370 + LinearRead_AKM1 = LinearRead_AKM1@20 @371 + LinearRead_AKM1M = LinearRead_AKM1M@24 @372 + LinearRead_AKM2 = LinearRead_AKM2@20 @373 + LinearRead_AKM2M = LinearRead_AKM2M@24 @374 + LinearRead_PK = LinearRead_PK@24 @375 + LinearRead_PKM = LinearRead_PKM@28 @376 + LinearWrite = LinearWrite@24 @377 + LinearWriteM = LinearWriteM@28 @378 + LinearWriteSamKey = LinearWriteSamKey@24 @379 + LinearWriteSamKeyM = LinearWriteSamKeyM@28 @380 + LinearWrite_AKM1 = LinearWrite_AKM1@20 @381 + LinearWrite_AKM1M = LinearWrite_AKM1M@24 @382 + LinearWrite_AKM2 = LinearWrite_AKM2@20 @383 + LinearWrite_AKM2M = LinearWrite_AKM2M@24 @384 + LinearWrite_PK = LinearWrite_PK@24 @385 + LinearWrite_PKM = LinearWrite_PKM@28 @386 + ListCards = ListCards@8 @387 + ListCardsM = ListCardsM@12 @388 + MFP_AesAuthSecurityLevel1 = MFP_AesAuthSecurityLevel1@4 @389 + MFP_AesAuthSecurityLevel1M = MFP_AesAuthSecurityLevel1M@8 @390 + MFP_AesAuthSecurityLevel1_PK = MFP_AesAuthSecurityLevel1_PK@4 @391 + MFP_AesAuthSecurityLevel1_PKM = MFP_AesAuthSecurityLevel1_PKM@8 @392 + MFP_ChangeConfigurationKey = MFP_ChangeConfigurationKey@8 @393 + MFP_ChangeConfigurationKeyM = MFP_ChangeConfigurationKeyM@12 @394 + MFP_ChangeConfigurationKeySamKey = MFP_ChangeConfigurationKeySamKey@8 @395 + MFP_ChangeConfigurationKeySamKeyM = MFP_ChangeConfigurationKeySamKeyM@12 @396 + MFP_ChangeConfigurationKey_PK = MFP_ChangeConfigurationKey_PK@8 @397 + MFP_ChangeConfigurationKey_PKM = MFP_ChangeConfigurationKey_PKM@12 @398 + MFP_ChangeMasterKey = MFP_ChangeMasterKey@8 @399 + MFP_ChangeMasterKeyM = MFP_ChangeMasterKeyM@12 @400 + MFP_ChangeMasterKeySamKey = MFP_ChangeMasterKeySamKey@8 @401 + MFP_ChangeMasterKeySamKeyM = MFP_ChangeMasterKeySamKeyM@12 @402 + MFP_ChangeMasterKey_PK = MFP_ChangeMasterKey_PK@8 @403 + MFP_ChangeMasterKey_PKM = MFP_ChangeMasterKey_PKM@12 @404 + MFP_ChangeSectorExtKey = MFP_ChangeSectorExtKey@20 @405 + MFP_ChangeSectorExtKeyM = MFP_ChangeSectorExtKeyM@24 @406 + MFP_ChangeSectorKey = MFP_ChangeSectorKey@16 @407 + MFP_ChangeSectorKeyExt_PK = MFP_ChangeSectorKeyExt_PK@20 @408 + MFP_ChangeSectorKeyExt_PKM = MFP_ChangeSectorKeyExt_PKM@24 @409 + MFP_ChangeSectorKeyM = MFP_ChangeSectorKeyM@20 @410 + MFP_ChangeSectorKeySamExtKey = MFP_ChangeSectorKeySamExtKey@20 @411 + MFP_ChangeSectorKeySamExtKeyM = MFP_ChangeSectorKeySamExtKeyM@24 @412 + MFP_ChangeSectorKeySamKey = MFP_ChangeSectorKeySamKey@16 @413 + MFP_ChangeSectorKeySamKeyM = MFP_ChangeSectorKeySamKeyM@20 @414 + MFP_ChangeSectorKey_PK = MFP_ChangeSectorKey_PK@16 @415 + MFP_ChangeSectorKey_PKM = MFP_ChangeSectorKey_PKM@20 @416 + MFP_ChangeVcPollingEncKey = MFP_ChangeVcPollingEncKey@8 @417 + MFP_ChangeVcPollingEncKeyM = MFP_ChangeVcPollingEncKeyM@12 @418 + MFP_ChangeVcPollingEncKeySamKey = MFP_ChangeVcPollingEncKeySamKey@8 @419 + MFP_ChangeVcPollingEncKeySamKeyM = MFP_ChangeVcPollingEncKeySamKeyM@12 @420 + MFP_ChangeVcPollingEncKey_PK = MFP_ChangeVcPollingEncKey_PK@8 @421 + MFP_ChangeVcPollingEncKey_PKM = MFP_ChangeVcPollingEncKey_PKM@12 @422 + MFP_ChangeVcPollingMacKey = MFP_ChangeVcPollingMacKey@8 @423 + MFP_ChangeVcPollingMacKeyM = MFP_ChangeVcPollingMacKeyM@12 @424 + MFP_ChangeVcPollingMacKeySamKey = MFP_ChangeVcPollingMacKeySamKey@8 @425 + MFP_ChangeVcPollingMacKeySamKeyM = MFP_ChangeVcPollingMacKeySamKeyM@12 @426 + MFP_ChangeVcPollingMacKey_PK = MFP_ChangeVcPollingMacKey_PK@8 @427 + MFP_ChangeVcPollingMacKey_PKM = MFP_ChangeVcPollingMacKey_PKM@12 @428 + MFP_CommitPerso = MFP_CommitPerso@0 @429 + MFP_CommitPersoM = MFP_CommitPersoM@4 @430 + MFP_FieldConfigurationSet = MFP_FieldConfigurationSet@12 @431 + MFP_FieldConfigurationSetM = MFP_FieldConfigurationSetM@16 @432 + MFP_FieldConfigurationSetSamKey = MFP_FieldConfigurationSetSamKey@12 @433 + MFP_FieldConfigurationSetSamKeyM = MFP_FieldConfigurationSetSamKeyM@16 @434 + MFP_FieldConfigurationSet_PK = MFP_FieldConfigurationSet_PK@12 @435 + MFP_FieldConfigurationSet_PKM = MFP_FieldConfigurationSet_PKM@16 @436 + MFP_GetUid = MFP_GetUid@16 @437 + MFP_GetUidM = MFP_GetUidM@20 @438 + MFP_GetUidSamKey = MFP_GetUidSamKey@16 @439 + MFP_GetUidSamKeyM = MFP_GetUidSamKeyM@20 @440 + MFP_GetUid_PK = MFP_GetUid_PK@16 @441 + MFP_GetUid_PKM = MFP_GetUid_PKM@20 @442 + MFP_PersonalizationMinimal = MFP_PersonalizationMinimal@36 @443 + MFP_PersonalizationMinimalM = MFP_PersonalizationMinimalM@40 @444 + MFP_SwitchToSecurityLevel3 = MFP_SwitchToSecurityLevel3@4 @445 + MFP_SwitchToSecurityLevel3M = MFP_SwitchToSecurityLevel3M@8 @446 + MFP_SwitchToSecurityLevel3_PK = MFP_SwitchToSecurityLevel3_PK@4 @447 + MFP_SwitchToSecurityLevel3_PKM = MFP_SwitchToSecurityLevel3_PKM@8 @448 + MFP_WritePerso = MFP_WritePerso@8 @449 + MFP_WritePersoM = MFP_WritePersoM@12 @450 + MRTDAppSelectAndAuthenticateBac = MRTDAppSelectAndAuthenticateBac@16 @451 + MRTDAppSelectAndAuthenticateBacM = MRTDAppSelectAndAuthenticateBacM@20 @452 + MRTDFileReadBacToHeap = MRTDFileReadBacToHeap@24 @453 + MRTDFileReadBacToHeapM = MRTDFileReadBacToHeapM@28 @454 + MRTDGetDGTagListFromCOM = MRTDGetDGTagListFromCOM@16 @455 + MRTDGetDgIndex = MRTDGetDgIndex@4 @456 + MRTDGetDgName = MRTDGetDgName@4 @457 + MRTDGetImageFromDG2 = MRTDGetImageFromDG2@20 @458 + MRTDGetImageFromDG2ToFile = MRTDGetImageFromDG2ToFile@12 @459 + MRTDParseDG1ToHeap = MRTDParseDG1ToHeap@16 @460 + MRTDValidate = MRTDValidate@28 @461 + MRTDValidateM = MRTDValidateM@32 @462 + MRTD_MRZCheck = MRTD_MRZCheck@8 @463 + MRTD_MRZDataToMRZProtoKey = MRTD_MRZDataToMRZProtoKey@16 @464 + MRTD_MRZSubjacentCheck = MRTD_MRZSubjacentCheck@4 @465 + MRTD_MRZSubjacentToMRZProtoKey = MRTD_MRZSubjacentToMRZProtoKey@8 @466 + MRTD_ReadDocumentData = MRTD_ReadDocumentData@8 @467 + MRTD_SOD_CertToHeap = MRTD_SOD_CertToHeap@20 @468 + MRTD_SOD_CertToHeapM = MRTD_SOD_CertToHeapM@24 @469 + MRTD_SessionClose = MRTD_SessionClose@0 @470 + MRTD_SessionInit = MRTD_SessionInit@12 @471 + NfcT2TSafeConvertVersion = NfcT2TSafeConvertVersion@8 @472 + Open_ISO7816_Generic = Open_ISO7816_Generic@8 @473 + Open_ISO7816_GenericM = Open_ISO7816_GenericM@12 @474 + OriginalityCheck = OriginalityCheck@16 @475 + PN7462_CodeProtect = PN7462_CodeProtect@0 @476 + PN7462_ESP32_boot_init = PN7462_ESP32_boot_init@8 @477 + PN7462_ExtField = PN7462_ExtField@0 @478 + PN7462_LpcdCalibration = PN7462_LpcdCalibration@8 @479 + PN7462_LpcdPerform = PN7462_LpcdPerform@16 @480 + PN7462_RfOff = PN7462_RfOff@0 @481 + PN7462_RfOn = PN7462_RfOn@0 @482 + PN7462_Test = PN7462_Test@4 @483 + PN7462_WriteParams = PN7462_WriteParams@24 @484 + PN7462_WriteParamsUsb = PN7462_WriteParamsUsb@24 @485 + ParamTest1 = ParamTest1@8 @486 + ParamTest2 = ParamTest2@8 @487 + ParseNdefMessage = ParseNdefMessage@16 @488 + ProgReader = ProgReader@16 @489 + ProgReaderStreamUsb = ProgReaderStreamUsb@8 @490 + ProgReaderUsb = ProgReaderUsb@16 @491 + ReadCounter = ReadCounter@8 @492 + ReadCounterM = ReadCounterM@12 @493 + ReadECCSignature = ReadECCSignature@16 @494 + ReadECCSignatureExt = ReadECCSignatureExt@20 @495 + ReadECCSignatureExtM = ReadECCSignatureExtM@24 @496 + ReadECCSignatureM = ReadECCSignatureM@20 @497 + ReadNFCCounter = ReadNFCCounter@4 @498 + ReadNFCCounterM = ReadNFCCounterM@8 @499 + ReadNFCCounterPwdAuth_PK = ReadNFCCounterPwdAuth_PK@8 @500 + ReadNFCCounterPwdAuth_PKM = ReadNFCCounterPwdAuth_PKM@12 @501 + ReadNFCCounterPwdAuth_RK = ReadNFCCounterPwdAuth_RK@8 @502 + ReadNFCCounterPwdAuth_RKM = ReadNFCCounterPwdAuth_RKM@12 @503 + ReadNdefRecord_Address = ReadNdefRecord_Address@4 @504 + ReadNdefRecord_AddressM = ReadNdefRecord_AddressM@8 @505 + ReadNdefRecord_AndroidApp = ReadNdefRecord_AndroidApp@4 @506 + ReadNdefRecord_AndroidAppM = ReadNdefRecord_AndroidAppM@8 @507 + ReadNdefRecord_BT = ReadNdefRecord_BT@4 @508 + ReadNdefRecord_BTM = ReadNdefRecord_BTM@8 @509 + ReadNdefRecord_Bitcoin = ReadNdefRecord_Bitcoin@12 @510 + ReadNdefRecord_BitcoinM = ReadNdefRecord_BitcoinM@16 @511 + ReadNdefRecord_Contact = ReadNdefRecord_Contact@4 @512 + ReadNdefRecord_ContactM = ReadNdefRecord_ContactM@8 @513 + ReadNdefRecord_Email = ReadNdefRecord_Email@12 @514 + ReadNdefRecord_EmailM = ReadNdefRecord_EmailM@16 @515 + ReadNdefRecord_GeoLocation = ReadNdefRecord_GeoLocation@8 @516 + ReadNdefRecord_GeoLocationM = ReadNdefRecord_GeoLocationM@12 @517 + ReadNdefRecord_NaviDestination = ReadNdefRecord_NaviDestination@4 @518 + ReadNdefRecord_NaviDestinationM = ReadNdefRecord_NaviDestinationM@8 @519 + ReadNdefRecord_Phone = ReadNdefRecord_Phone@4 @520 + ReadNdefRecord_PhoneM = ReadNdefRecord_PhoneM@8 @521 + ReadNdefRecord_SMS = ReadNdefRecord_SMS@8 @522 + ReadNdefRecord_SMSM = ReadNdefRecord_SMSM@12 @523 + ReadNdefRecord_Skype = ReadNdefRecord_Skype@8 @524 + ReadNdefRecord_SkypeM = ReadNdefRecord_SkypeM@12 @525 + ReadNdefRecord_StreetView = ReadNdefRecord_StreetView@8 @526 + ReadNdefRecord_StreetViewM = ReadNdefRecord_StreetViewM@12 @527 + ReadNdefRecord_Text = ReadNdefRecord_Text@4 @528 + ReadNdefRecord_TextM = ReadNdefRecord_TextM@8 @529 + ReadNdefRecord_Viber = ReadNdefRecord_Viber@4 @530 + ReadNdefRecord_ViberM = ReadNdefRecord_ViberM@8 @531 + ReadNdefRecord_Whatsapp = ReadNdefRecord_Whatsapp@4 @532 + ReadNdefRecord_WhatsappM = ReadNdefRecord_WhatsappM@8 @533 + ReadNdefRecord_WiFi = ReadNdefRecord_WiFi@16 @534 + ReadNdefRecord_WiFiM = ReadNdefRecord_WiFiM@20 @535 + ReadShareRam = ReadShareRam@12 @536 + ReadShareRamM = ReadShareRamM@16 @537 + ReadTTStatus = ReadTTStatus@8 @538 + ReadTTStatusM = ReadTTStatusM@12 @539 + ReadUserData = ReadUserData@4 @540 + ReadUserDataExt = ReadUserDataExt@4 @541 + ReadUserDataExtM = ReadUserDataExtM@8 @542 + ReadUserDataM = ReadUserDataM@8 @543 + ReaderClose = ReaderClose@0 @544 + ReaderCloseM = ReaderCloseM@4 @545 + ReaderEepromRead = ReaderEepromRead@12 @546 + ReaderEepromReadM = ReaderEepromReadM@16 @547 + ReaderEepromWrite = ReaderEepromWrite@16 @548 + ReaderEepromWriteM = ReaderEepromWriteM@20 @549 + ReaderHwReset = ReaderHwReset@0 @550 + ReaderKeyWrite = ReaderKeyWrite@8 @551 + ReaderKeyWriteM = ReaderKeyWriteM@12 @552 + ReaderKeysLock = ReaderKeysLock@4 @553 + ReaderKeysLockM = ReaderKeysLockM@8 @554 + ReaderKeysUnlock = ReaderKeysUnlock@4 @555 + ReaderKeysUnlockM = ReaderKeysUnlockM@8 @556 + ReaderList_Add = ReaderList_Add@20 @557 + ReaderList_Destroy = ReaderList_Destroy@4 @558 + ReaderList_GetFTDIDescriptionByIndex = ReaderList_GetFTDIDescriptionByIndex@8 @559 + ReaderList_GetFTDISerialByIndex = ReaderList_GetFTDISerialByIndex@8 @560 + ReaderList_GetInformation = ReaderList_GetInformation@44 @561 + ReaderList_GetSerialByIndex = ReaderList_GetSerialByIndex@8 @562 + ReaderList_GetSerialDescriptionByIndex = ReaderList_GetSerialDescriptionByIndex@8 @563 + ReaderList_GetTypeByIndex = ReaderList_GetTypeByIndex@8 @564 + ReaderList_OpenByIndex = ReaderList_OpenByIndex@8 @565 + ReaderList_OpenBySerial = ReaderList_OpenBySerial@8 @566 + ReaderList_UpdateAndGetCount = ReaderList_UpdateAndGetCount@4 @567 + ReaderOpen = ReaderOpen@0 @568 + ReaderOpenByType = ReaderOpenByType@4 @569 + ReaderOpenEx = ReaderOpenEx@16 @570 + ReaderOpenM = ReaderOpenM@4 @571 + ReaderOpen_uFROnline = ReaderOpen_uFROnline@4 @572 + ReaderReset = ReaderReset@0 @573 + ReaderResetM = ReaderResetM@4 @574 + ReaderResetWait = ReaderResetWait@0 @575 + ReaderRfOff = ReaderRfOff@0 @576 + ReaderRfOffM = ReaderRfOffM@4 @577 + ReaderRfOn = ReaderRfOn@0 @578 + ReaderRfOnM = ReaderRfOnM@4 @579 + ReaderRfReset = ReaderRfReset@0 @580 + ReaderRfResetM = ReaderRfResetM@4 @581 + ReaderSoftRestart = ReaderSoftRestart@0 @582 + ReaderSoftRestartM = ReaderSoftRestartM@4 @583 + ReaderSoundVolume = ReaderSoundVolume@4 @584 + ReaderSoundVolumeM = ReaderSoundVolumeM@8 @585 + ReaderStillConnected = ReaderStillConnected@4 @586 + ReaderStillConnectedM = ReaderStillConnectedM@8 @587 + ReaderUISignal = ReaderUISignal@8 @588 + ReaderUISignalM = ReaderUISignalM@12 @589 + RgbControl = RgbControl@12 @590 + RgbControlM = RgbControlM@16 @591 + RgbIdleDefault = RgbIdleDefault@0 @592 + RgbIdleDefaultM = RgbIdleDefaultM@4 @593 + RgbIdleSet = RgbIdleSet@12 @594 + RgbIdleSetM = RgbIdleSetM@16 @595 + RgbInternalTurnOff = RgbInternalTurnOff@0 @596 + RgbInternalTurnOffM = RgbInternalTurnOffM@4 @597 + RgbInternalTurnOn = RgbInternalTurnOn@0 @598 + RgbInternalTurnOnM = RgbInternalTurnOnM@4 @599 + SAM_authenticate_host_AV2_plain = SAM_authenticate_host_AV2_plain@16 @600 + SAM_authenticate_host_AV2_plainM = SAM_authenticate_host_AV2_plainM@20 @601 + SAM_authenticate_host_no_div_des = SAM_authenticate_host_no_div_des@12 @602 + SAM_authenticate_host_no_div_desM = SAM_authenticate_host_no_div_desM@16 @603 + SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key = SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key@24 @604 + SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_keyM = SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_keyM@28 @605 + SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key = SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key@24 @606 + SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_keyM = SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_keyM@28 @607 + SAM_change_key_entry_3K3DES_AV2_plain_one_key = SAM_change_key_entry_3K3DES_AV2_plain_one_key@24 @608 + SAM_change_key_entry_3K3DES_AV2_plain_one_keyM = SAM_change_key_entry_3K3DES_AV2_plain_one_keyM@28 @609 + SAM_change_key_entry_AES_AV2_plain_one_key = SAM_change_key_entry_AES_AV2_plain_one_key@24 @610 + SAM_change_key_entry_AES_AV2_plain_one_keyM = SAM_change_key_entry_AES_AV2_plain_one_keyM@28 @611 + SAM_change_key_entry_DES_AV2_plain_one_key = SAM_change_key_entry_DES_AV2_plain_one_key@24 @612 + SAM_change_key_entry_aes_AV2_plain_host_key = SAM_change_key_entry_aes_AV2_plain_host_key@52 @613 + SAM_change_key_entry_aes_AV2_plain_host_keyM = SAM_change_key_entry_aes_AV2_plain_host_keyM@56 @614 + SAM_change_key_entry_mifare_AV2_plain_one_key = SAM_change_key_entry_mifare_AV2_plain_one_key@28 @615 + SAM_change_key_entry_mifare_AV2_plain_one_keyM = SAM_change_key_entry_mifare_AV2_plain_one_keyM@32 @616 + SAM_get_key_entry_raw = SAM_get_key_entry_raw@16 @617 + SAM_get_key_entry_rawM = SAM_get_key_entry_rawM@20 @618 + SAM_get_version = SAM_get_version@8 @619 + SAM_get_versionM = SAM_get_versionM@12 @620 + SAM_get_version_raw = SAM_get_version_raw@8 @621 + SAM_get_version_rawM = SAM_get_version_rawM@12 @622 + SAM_pre_personalization_switch_to_AV2_mode = SAM_pre_personalization_switch_to_AV2_mode@12 @623 + SAM_pre_personalization_switch_to_AV2_modeM = SAM_pre_personalization_switch_to_AV2_modeM@16 @624 + SAM_pre_pesonalization_master_AES128_key = SAM_pre_pesonalization_master_AES128_key@28 @625 + SAM_pre_pesonalization_master_AES128_keyM = SAM_pre_pesonalization_master_AES128_keyM@32 @626 + SectorTrailerWrite = SectorTrailerWrite@44 @627 + SectorTrailerWriteM = SectorTrailerWriteM@48 @628 + SectorTrailerWriteSamKey = SectorTrailerWriteSamKey@44 @629 + SectorTrailerWriteSamKeyM = SectorTrailerWriteSamKeyM@48 @630 + SectorTrailerWriteUnsafe = SectorTrailerWriteUnsafe@20 @631 + SectorTrailerWriteUnsafeM = SectorTrailerWriteUnsafeM@24 @632 + SectorTrailerWriteUnsafe_AKM1 = SectorTrailerWriteUnsafe_AKM1@16 @633 + SectorTrailerWriteUnsafe_AKM1M = SectorTrailerWriteUnsafe_AKM1M@20 @634 + SectorTrailerWriteUnsafe_AKM2 = SectorTrailerWriteUnsafe_AKM2@16 @635 + SectorTrailerWriteUnsafe_AKM2M = SectorTrailerWriteUnsafe_AKM2M@20 @636 + SectorTrailerWriteUnsafe_PK = SectorTrailerWriteUnsafe_PK@20 @637 + SectorTrailerWriteUnsafe_PKM = SectorTrailerWriteUnsafe_PKM@24 @638 + SectorTrailerWrite_AKM1 = SectorTrailerWrite_AKM1@40 @639 + SectorTrailerWrite_AKM1M = SectorTrailerWrite_AKM1M@44 @640 + SectorTrailerWrite_AKM2 = SectorTrailerWrite_AKM2@40 @641 + SectorTrailerWrite_AKM2M = SectorTrailerWrite_AKM2M@44 @642 + SectorTrailerWrite_PK = SectorTrailerWrite_PK@44 @643 + SectorTrailerWrite_PKM = SectorTrailerWrite_PKM@48 @644 + SelectCard = SelectCard@12 @645 + SelectCardM = SelectCardM@16 @646 + SetATECC608DefaultKeysConfiguration = SetATECC608DefaultKeysConfiguration@0 @647 + SetATECC608DefaultKeysConfigurationM = SetATECC608DefaultKeysConfigurationM@4 @648 + SetATECC608DefaultSlotsConfiguration = SetATECC608DefaultSlotsConfiguration@0 @649 + SetATECC608DefaultSlotsConfigurationM = SetATECC608DefaultSlotsConfigurationM@4 @650 + SetATECC608ECCPrivateKey = SetATECC608ECCPrivateKey@20 @651 + SetATECC608ECCPrivateKeyM = SetATECC608ECCPrivateKeyM@24 @652 + SetATECC608ECCPrivateKeyUnencrypted = SetATECC608ECCPrivateKeyUnencrypted@20 @653 + SetATECC608ECCPrivateKeyUnencryptedM = SetATECC608ECCPrivateKeyUnencryptedM@24 @654 + SetATECC608IOSecretKey = SetATECC608IOSecretKey@0 @655 + SetATECC608IOSecretKeyM = SetATECC608IOSecretKeyM@4 @656 + SetAdHocEmulationParams = SetAdHocEmulationParams@20 @657 + SetAdHocEmulationParamsM = SetAdHocEmulationParamsM@24 @658 + SetAsyncCardIdSendConfig = SetAsyncCardIdSendConfig@24 @659 + SetAsyncCardIdSendConfigEx = SetAsyncCardIdSendConfigEx@32 @660 + SetAsyncCardIdSendConfigExM = SetAsyncCardIdSendConfigExM@36 @661 + SetAsyncCardIdSendConfigM = SetAsyncCardIdSendConfigM@28 @662 + SetCustomUiConfig = SetCustomUiConfig@20 @663 + SetCustomUiConfigM = SetCustomUiConfigM@24 @664 + SetDefaultUartSpeed = SetDefaultUartSpeed@12 @665 + SetDiscoveryLoop = SetDiscoveryLoop@8 @666 + SetDiscoveryLoopM = SetDiscoveryLoopM@12 @667 + SetDisplayData = SetDisplayData@8 @668 + SetDisplayDataM = SetDisplayDataM@12 @669 + SetDisplayIntensity = SetDisplayIntensity@4 @670 + SetDisplayIntensityM = SetDisplayIntensityM@8 @671 + SetISO14443_4_DLStorage = SetISO14443_4_DLStorage@0 @672 + SetISO14443_4_DLStorageM = SetISO14443_4_DLStorageM@4 @673 + SetISO14443_4_Mode = SetISO14443_4_Mode@0 @674 + SetISO14443_4_ModeM = SetISO14443_4_ModeM@4 @675 + SetISO14443_4_Mode_GetATS = SetISO14443_4_Mode_GetATS@20 @676 + SetISO14443_4_Mode_GetATSM = SetISO14443_4_Mode_GetATSM@24 @677 + SetLicenseData = SetLicenseData@4 @678 + SetMobileUniqueIdAid = SetMobileUniqueIdAid@8 @679 + SetMobileUniqueIdAidM = SetMobileUniqueIdAidM@12 @680 + SetReaderProMode = SetReaderProMode@4 @681 + SetReaderProModeM = SetReaderProModeM@8 @682 + SetReaderSerialDescription = SetReaderSerialDescription@4 @683 + SetReaderSerialDescriptionM = SetReaderSerialDescriptionM@8 @684 + SetReaderTime = SetReaderTime@8 @685 + SetReaderTimeM = SetReaderTimeM@12 @686 + SetRfAnalogRegistersISO14443_212 = SetRfAnalogRegistersISO14443_212@20 @687 + SetRfAnalogRegistersISO14443_212Default = SetRfAnalogRegistersISO14443_212Default@0 @688 + SetRfAnalogRegistersISO14443_212DefaultM = SetRfAnalogRegistersISO14443_212DefaultM@4 @689 + SetRfAnalogRegistersISO14443_212M = SetRfAnalogRegistersISO14443_212M@24 @690 + SetRfAnalogRegistersISO14443_424 = SetRfAnalogRegistersISO14443_424@20 @691 + SetRfAnalogRegistersISO14443_424Default = SetRfAnalogRegistersISO14443_424Default@0 @692 + SetRfAnalogRegistersISO14443_424DefaultM = SetRfAnalogRegistersISO14443_424DefaultM@4 @693 + SetRfAnalogRegistersISO14443_424M = SetRfAnalogRegistersISO14443_424M@24 @694 + SetRfAnalogRegistersTypeA = SetRfAnalogRegistersTypeA@20 @695 + SetRfAnalogRegistersTypeADefault = SetRfAnalogRegistersTypeADefault@0 @696 + SetRfAnalogRegistersTypeADefaultM = SetRfAnalogRegistersTypeADefaultM@4 @697 + SetRfAnalogRegistersTypeAM = SetRfAnalogRegistersTypeAM@24 @698 + SetRfAnalogRegistersTypeATrans = SetRfAnalogRegistersTypeATrans@40 @699 + SetRfAnalogRegistersTypeATransM = SetRfAnalogRegistersTypeATransM@44 @700 + SetRfAnalogRegistersTypeB = SetRfAnalogRegistersTypeB@20 @701 + SetRfAnalogRegistersTypeBDefault = SetRfAnalogRegistersTypeBDefault@0 @702 + SetRfAnalogRegistersTypeBDefaultM = SetRfAnalogRegistersTypeBDefaultM@4 @703 + SetRfAnalogRegistersTypeBM = SetRfAnalogRegistersTypeBM@24 @704 + SetRfAnalogRegistersTypeBTrans = SetRfAnalogRegistersTypeBTrans@36 @705 + SetRfAnalogRegistersTypeBTransM = SetRfAnalogRegistersTypeBTransM@40 @706 + SetRgbData = SetRgbData@12 @707 + SetRgbDataM = SetRgbDataM@16 @708 + SetRgbIntensity = SetRgbIntensity@4 @709 + SetRgbIntensityM = SetRgbIntensityM@8 @710 + SetServiceData = SetServiceData@4 @711 + SetServiceDataM = SetServiceDataM@8 @712 + SetSpeakerFrequency = SetSpeakerFrequency@4 @713 + SetSpeakerFrequencyM = SetSpeakerFrequencyM@8 @714 + SetSpeedPermanently = SetSpeedPermanently@8 @715 + SetSpeedPermanentlyM = SetSpeedPermanentlyM@12 @716 + SetUartSpeed = SetUartSpeed@4 @717 + StartAsyncSession = StartAsyncSession@8 @718 + StopAsyncSession = StopAsyncSession@0 @719 + SubscribeBlock = SubscribeBlock@8 @720 + SubscribeSector = SubscribeSector@8 @721 + TagEmulationMirrorCounterDisabled = TagEmulationMirrorCounterDisabled@0 @722 + TagEmulationMirrorCounterNonResetEnabled = TagEmulationMirrorCounterNonResetEnabled@4 @723 + TagEmulationMirrorCounterResetEnabled = TagEmulationMirrorCounterResetEnabled@4 @724 + TagEmulationStart = TagEmulationStart@0 @725 + TagEmulationStartM = TagEmulationStartM@4 @726 + TagEmulationStartRam = TagEmulationStartRam@0 @727 + TagEmulationStop = TagEmulationStop@0 @728 + TagEmulationStopM = TagEmulationStopM@4 @729 + TagEmulationStopRam = TagEmulationStopRam@0 @730 + UFR_DLCardType2String = UFR_DLCardType2String@4 @731 + UFR_SessionStatus2String = UFR_SessionStatus2String@4 @732 + UFR_Status2String = UFR_Status2String@4 @733 + ULC_ExternalAuth_PK = ULC_ExternalAuth_PK@4 @734 + ULC_ExternalAuth_PKM = ULC_ExternalAuth_PKM@8 @735 + ULC_write_3des_key = ULC_write_3des_key@8 @736 + ULC_write_3des_keyM = ULC_write_3des_keyM@12 @737 + ULC_write_3des_key_factory_key = ULC_write_3des_key_factory_key@4 @738 + ULC_write_3des_key_factory_keyM = ULC_write_3des_key_factory_keyM@8 @739 + ULC_write_3des_key_factory_key_internal = ULC_write_3des_key_factory_key_internal@4 @740 + ULC_write_3des_key_factory_key_internalM = ULC_write_3des_key_factory_key_internalM@8 @741 + ULC_write_3des_key_internal = ULC_write_3des_key_internal@8 @742 + ULC_write_3des_key_internalM = ULC_write_3des_key_internalM@12 @743 + ULC_write_3des_key_no_auth = ULC_write_3des_key_no_auth@4 @744 + ULC_write_3des_key_no_authM = ULC_write_3des_key_no_authM@8 @745 + ULC_write_3des_key_no_auth_internal = ULC_write_3des_key_no_auth_internal@4 @746 + ULC_write_3des_key_no_auth_internalM = ULC_write_3des_key_no_auth_internalM@8 @747 + UfrEnterSleepMode = UfrEnterSleepMode@0 @748 + UfrEnterSleepModeM = UfrEnterSleepModeM@4 @749 + UfrGetBadSelectCardNrMax = UfrGetBadSelectCardNrMax@4 @750 + UfrGetBadSelectCardNrMaxM = UfrGetBadSelectCardNrMaxM@8 @751 + UfrGetInputState = UfrGetInputState@8 @752 + UfrLeaveSleepMode = UfrLeaveSleepMode@0 @753 + UfrLeaveSleepModeM = UfrLeaveSleepModeM@4 @754 + UfrOutControl = UfrOutControl@20 @755 + UfrOutControlM = UfrOutControlM@24 @756 + UfrRedLightControl = UfrRedLightControl@4 @757 + UfrRedLightControlM = UfrRedLightControlM@8 @758 + UfrRgbExtLightControl = UfrRgbExtLightControl@4 @759 + UfrRgbExtLightControlM = UfrRgbExtLightControlM@8 @760 + UfrRgbLightControl = UfrRgbLightControl@20 @761 + UfrRgbLightControlM = UfrRgbLightControlM@24 @762 + UfrRgbLightControlRfPeriod = UfrRgbLightControlRfPeriod@32 @763 + UfrRgbLightControlRfPeriodM = UfrRgbLightControlRfPeriodM@36 @764 + UfrRgbLightControlSleep = UfrRgbLightControlSleep@28 @765 + UfrRgbLightControlSleepM = UfrRgbLightControlSleepM@32 @766 + UfrSetBadSelectCardNrMax = UfrSetBadSelectCardNrMax@4 @767 + UfrSetBadSelectCardNrMaxM = UfrSetBadSelectCardNrMaxM@8 @768 + UfrXrcGetIoState = UfrXrcGetIoState@12 @769 + UfrXrcGetIoStateM = UfrXrcGetIoStateM@16 @770 + UfrXrcLockOn = UfrXrcLockOn@4 @771 + UfrXrcLockOnM = UfrXrcLockOnM@8 @772 + UfrXrcRelayState = UfrXrcRelayState@4 @773 + UfrXrcRelayStateM = UfrXrcRelayStateM@8 @774 + ValueBlockDecrement = ValueBlockDecrement@16 @775 + ValueBlockDecrementM = ValueBlockDecrementM@20 @776 + ValueBlockDecrementSamKey = ValueBlockDecrementSamKey@16 @777 + ValueBlockDecrementSamKeyM = ValueBlockDecrementSamKeyM@20 @778 + ValueBlockDecrement_AKM1 = ValueBlockDecrement_AKM1@12 @779 + ValueBlockDecrement_AKM1M = ValueBlockDecrement_AKM1M@16 @780 + ValueBlockDecrement_AKM2 = ValueBlockDecrement_AKM2@12 @781 + ValueBlockDecrement_AKM2M = ValueBlockDecrement_AKM2M@16 @782 + ValueBlockDecrement_PK = ValueBlockDecrement_PK@16 @783 + ValueBlockDecrement_PKM = ValueBlockDecrement_PKM@20 @784 + ValueBlockInSectorDecrement = ValueBlockInSectorDecrement@20 @785 + ValueBlockInSectorDecrementM = ValueBlockInSectorDecrementM@24 @786 + ValueBlockInSectorDecrementSamKey = ValueBlockInSectorDecrementSamKey@20 @787 + ValueBlockInSectorDecrementSamKeyM = ValueBlockInSectorDecrementSamKeyM@24 @788 + ValueBlockInSectorDecrement_AKM1 = ValueBlockInSectorDecrement_AKM1@16 @789 + ValueBlockInSectorDecrement_AKM1M = ValueBlockInSectorDecrement_AKM1M@20 @790 + ValueBlockInSectorDecrement_AKM2 = ValueBlockInSectorDecrement_AKM2@16 @791 + ValueBlockInSectorDecrement_AKM2M = ValueBlockInSectorDecrement_AKM2M@20 @792 + ValueBlockInSectorDecrement_PK = ValueBlockInSectorDecrement_PK@20 @793 + ValueBlockInSectorDecrement_PKM = ValueBlockInSectorDecrement_PKM@24 @794 + ValueBlockInSectorIncrement = ValueBlockInSectorIncrement@20 @795 + ValueBlockInSectorIncrementM = ValueBlockInSectorIncrementM@24 @796 + ValueBlockInSectorIncrementSamKey = ValueBlockInSectorIncrementSamKey@20 @797 + ValueBlockInSectorIncrementSamKeyM = ValueBlockInSectorIncrementSamKeyM@24 @798 + ValueBlockInSectorIncrement_AKM1 = ValueBlockInSectorIncrement_AKM1@16 @799 + ValueBlockInSectorIncrement_AKM1M = ValueBlockInSectorIncrement_AKM1M@20 @800 + ValueBlockInSectorIncrement_AKM2 = ValueBlockInSectorIncrement_AKM2@16 @801 + ValueBlockInSectorIncrement_AKM2M = ValueBlockInSectorIncrement_AKM2M@20 @802 + ValueBlockInSectorIncrement_PK = ValueBlockInSectorIncrement_PK@20 @803 + ValueBlockInSectorIncrement_PKM = ValueBlockInSectorIncrement_PKM@24 @804 + ValueBlockInSectorRead = ValueBlockInSectorRead@24 @805 + ValueBlockInSectorReadM = ValueBlockInSectorReadM@28 @806 + ValueBlockInSectorReadSamKey = ValueBlockInSectorReadSamKey@24 @807 + ValueBlockInSectorReadSamKeyM = ValueBlockInSectorReadSamKeyM@28 @808 + ValueBlockInSectorRead_AKM1 = ValueBlockInSectorRead_AKM1@20 @809 + ValueBlockInSectorRead_AKM1M = ValueBlockInSectorRead_AKM1M@24 @810 + ValueBlockInSectorRead_AKM2 = ValueBlockInSectorRead_AKM2@20 @811 + ValueBlockInSectorRead_AKM2M = ValueBlockInSectorRead_AKM2M@24 @812 + ValueBlockInSectorRead_PK = ValueBlockInSectorRead_PK@24 @813 + ValueBlockInSectorRead_PKM = ValueBlockInSectorRead_PKM@28 @814 + ValueBlockInSectorWrite = ValueBlockInSectorWrite@24 @815 + ValueBlockInSectorWriteM = ValueBlockInSectorWriteM@28 @816 + ValueBlockInSectorWriteSamKey = ValueBlockInSectorWriteSamKey@24 @817 + ValueBlockInSectorWriteSamKeyM = ValueBlockInSectorWriteSamKeyM@28 @818 + ValueBlockInSectorWrite_AKM1 = ValueBlockInSectorWrite_AKM1@20 @819 + ValueBlockInSectorWrite_AKM1M = ValueBlockInSectorWrite_AKM1M@24 @820 + ValueBlockInSectorWrite_AKM2 = ValueBlockInSectorWrite_AKM2@20 @821 + ValueBlockInSectorWrite_AKM2M = ValueBlockInSectorWrite_AKM2M@24 @822 + ValueBlockInSectorWrite_PK = ValueBlockInSectorWrite_PK@24 @823 + ValueBlockInSectorWrite_PKM = ValueBlockInSectorWrite_PKM@28 @824 + ValueBlockIncrement = ValueBlockIncrement@16 @825 + ValueBlockIncrementM = ValueBlockIncrementM@20 @826 + ValueBlockIncrementSamKey = ValueBlockIncrementSamKey@16 @827 + ValueBlockIncrementSamKeyM = ValueBlockIncrementSamKeyM@20 @828 + ValueBlockIncrement_AKM1 = ValueBlockIncrement_AKM1@12 @829 + ValueBlockIncrement_AKM1M = ValueBlockIncrement_AKM1M@16 @830 + ValueBlockIncrement_AKM2 = ValueBlockIncrement_AKM2@12 @831 + ValueBlockIncrement_AKM2M = ValueBlockIncrement_AKM2M@16 @832 + ValueBlockIncrement_PK = ValueBlockIncrement_PK@16 @833 + ValueBlockIncrement_PKM = ValueBlockIncrement_PKM@20 @834 + ValueBlockRead = ValueBlockRead@20 @835 + ValueBlockReadM = ValueBlockReadM@24 @836 + ValueBlockReadSamKey = ValueBlockReadSamKey@20 @837 + ValueBlockReadSamKeyM = ValueBlockReadSamKeyM@24 @838 + ValueBlockRead_AKM1 = ValueBlockRead_AKM1@16 @839 + ValueBlockRead_AKM1M = ValueBlockRead_AKM1M@20 @840 + ValueBlockRead_AKM2 = ValueBlockRead_AKM2@16 @841 + ValueBlockRead_AKM2M = ValueBlockRead_AKM2M@20 @842 + ValueBlockRead_PK = ValueBlockRead_PK@20 @843 + ValueBlockRead_PKM = ValueBlockRead_PKM@24 @844 + ValueBlockWrite = ValueBlockWrite@20 @845 + ValueBlockWriteM = ValueBlockWriteM@24 @846 + ValueBlockWriteSamKey = ValueBlockWriteSamKey@20 @847 + ValueBlockWriteSamKeyM = ValueBlockWriteSamKeyM@24 @848 + ValueBlockWrite_AKM1 = ValueBlockWrite_AKM1@16 @849 + ValueBlockWrite_AKM1M = ValueBlockWrite_AKM1M@20 @850 + ValueBlockWrite_AKM2 = ValueBlockWrite_AKM2@16 @851 + ValueBlockWrite_AKM2M = ValueBlockWrite_AKM2M@20 @852 + ValueBlockWrite_PK = ValueBlockWrite_PK@20 @853 + ValueBlockWrite_PKM = ValueBlockWrite_PKM@24 @854 + WriteEmulationNdef = WriteEmulationNdef@28 @855 + WriteEmulationNdefM = WriteEmulationNdefM@32 @856 + WriteEmulationNdefRam = WriteEmulationNdefRam@28 @857 + WriteEmulationNdefRamM = WriteEmulationNdefRamM@32 @858 + WriteEmulationNdefWithAAR = WriteEmulationNdefWithAAR@36 @859 + WriteNdefRecord_Address = WriteNdefRecord_Address@8 @860 + WriteNdefRecord_AddressM = WriteNdefRecord_AddressM@12 @861 + WriteNdefRecord_AndroidApp = WriteNdefRecord_AndroidApp@8 @862 + WriteNdefRecord_AndroidAppM = WriteNdefRecord_AndroidAppM@12 @863 + WriteNdefRecord_BT = WriteNdefRecord_BT@8 @864 + WriteNdefRecord_BTM = WriteNdefRecord_BTM@12 @865 + WriteNdefRecord_Bitcoin = WriteNdefRecord_Bitcoin@16 @866 + WriteNdefRecord_BitcoinM = WriteNdefRecord_BitcoinM@20 @867 + WriteNdefRecord_Contact = WriteNdefRecord_Contact@28 @868 + WriteNdefRecord_ContactM = WriteNdefRecord_ContactM@32 @869 + WriteNdefRecord_Email = WriteNdefRecord_Email@16 @870 + WriteNdefRecord_EmailM = WriteNdefRecord_EmailM@20 @871 + WriteNdefRecord_GeoLocation = WriteNdefRecord_GeoLocation@12 @872 + WriteNdefRecord_GeoLocationM = WriteNdefRecord_GeoLocationM@16 @873 + WriteNdefRecord_NaviDestination = WriteNdefRecord_NaviDestination@8 @874 + WriteNdefRecord_NaviDestinationM = WriteNdefRecord_NaviDestinationM@12 @875 + WriteNdefRecord_Phone = WriteNdefRecord_Phone@8 @876 + WriteNdefRecord_PhoneM = WriteNdefRecord_PhoneM@12 @877 + WriteNdefRecord_SMS = WriteNdefRecord_SMS@12 @878 + WriteNdefRecord_SMSM = WriteNdefRecord_SMSM@16 @879 + WriteNdefRecord_Skype = WriteNdefRecord_Skype@12 @880 + WriteNdefRecord_SkypeM = WriteNdefRecord_SkypeM@16 @881 + WriteNdefRecord_StreetView = WriteNdefRecord_StreetView@12 @882 + WriteNdefRecord_StreetViewM = WriteNdefRecord_StreetViewM@16 @883 + WriteNdefRecord_Text = WriteNdefRecord_Text@8 @884 + WriteNdefRecord_TextM = WriteNdefRecord_TextM@12 @885 + WriteNdefRecord_Viber = WriteNdefRecord_Viber@8 @886 + WriteNdefRecord_ViberM = WriteNdefRecord_ViberM@12 @887 + WriteNdefRecord_Whatsapp = WriteNdefRecord_Whatsapp@8 @888 + WriteNdefRecord_WhatsappM = WriteNdefRecord_WhatsappM@12 @889 + WriteNdefRecord_WiFi = WriteNdefRecord_WiFi@20 @890 + WriteNdefRecord_WiFiM = WriteNdefRecord_WiFiM@24 @891 + WriteReaderId = WriteReaderId@4 @892 + WriteReaderIdM = WriteReaderIdM@8 @893 + WriteSamUnlockKey = WriteSamUnlockKey@12 @894 + WriteSamUnlockKeyM = WriteSamUnlockKeyM@16 @895 + WriteShareRam = WriteShareRam@12 @896 + WriteShareRamM = WriteShareRamM@16 @897 + WriteUserData = WriteUserData@4 @898 + WriteUserDataExt = WriteUserDataExt@4 @899 + WriteUserDataExtM = WriteUserDataExtM@8 @900 + WriteUserDataM = WriteUserDataM@8 @901 + ais_erase_right_record = ais_erase_right_record@4 @902 + ais_erase_right_recordM = ais_erase_right_recordM@8 @903 + ais_get_card_daily_duration = ais_get_card_daily_duration@4 @904 + ais_get_card_daily_durationM = ais_get_card_daily_durationM@8 @905 + ais_get_card_number = ais_get_card_number@4 @906 + ais_get_card_numberM = ais_get_card_numberM@8 @907 + ais_get_card_total_duration = ais_get_card_total_duration@4 @908 + ais_get_card_total_durationM = ais_get_card_total_durationM@8 @909 + ais_get_card_type = ais_get_card_type@4 @910 + ais_get_card_typeM = ais_get_card_typeM@8 @911 + ais_get_credit_and_period_validity = ais_get_credit_and_period_validity@44 @912 + ais_get_credit_and_period_validityM = ais_get_credit_and_period_validityM@48 @913 + ais_get_right_record = ais_get_right_record@32 @914 + ais_get_right_recordM = ais_get_right_recordM@36 @915 + ais_get_right_record_type_max_daily_counter = ais_get_right_record_type_max_daily_counter@36 @916 + ais_get_right_record_type_max_daily_counterM = ais_get_right_record_type_max_daily_counterM@40 @917 + ais_get_right_type_record = ais_get_right_type_record@12 @918 + ais_get_right_type_recordM = ais_get_right_type_recordM@16 @919 + ais_get_validate_record = ais_get_validate_record@40 @920 + ais_get_validate_recordM = ais_get_validate_recordM@44 @921 + ais_set_card_daily_duration = ais_set_card_daily_duration@4 @922 + ais_set_card_daily_durationM = ais_set_card_daily_durationM@8 @923 + ais_set_card_total_duration = ais_set_card_total_duration@4 @924 + ais_set_card_total_durationM = ais_set_card_total_durationM@8 @925 + ais_set_card_type = ais_set_card_type@4 @926 + ais_set_card_typeM = ais_set_card_typeM@8 @927 + ais_set_credit_and_period_validity = ais_set_credit_and_period_validity@44 @928 + ais_set_credit_and_period_validityM = ais_set_credit_and_period_validityM@48 @929 + ais_set_right_record = ais_set_right_record@32 @930 + ais_set_right_recordM = ais_set_right_recordM@36 @931 + ais_set_right_record_type_max_daily_counter = ais_set_right_record_type_max_daily_counter@36 @932 + ais_set_right_record_type_max_daily_counterM = ais_set_right_record_type_max_daily_counterM@40 @933 + ais_set_right_type_record = ais_set_right_type_record@12 @934 + ais_set_right_type_recordM = ais_set_right_type_recordM@16 @935 + ais_set_validate_record = ais_set_validate_record@40 @936 + ais_set_validate_recordM = ais_set_validate_recordM@44 @937 + card_halt_enable = card_halt_enable@0 @938 + card_halt_enableM = card_halt_enableM@4 @939 + card_transceive = card_transceive@40 @940 + card_transceiveM = card_transceiveM@44 @941 + card_transceive_mode_start = card_transceive_mode_start@16 @942 + card_transceive_mode_startM = card_transceive_mode_startM@20 @943 + card_transceive_mode_stop = card_transceive_mode_stop@0 @944 + card_transceive_mode_stopM = card_transceive_mode_stopM@4 @945 + close_ISO7816_interface_APDU_ISO14443_4 = close_ISO7816_interface_APDU_ISO14443_4@0 @946 + close_ISO7816_interface_APDU_ISO14443_4M = close_ISO7816_interface_APDU_ISO14443_4M@4 @947 + close_ISO7816_interface_no_APDU = close_ISO7816_interface_no_APDU@0 @948 + close_ISO7816_interface_no_APDUM = close_ISO7816_interface_no_APDUM@4 @949 + desfire_check_clear_record_transaction_mac = desfire_check_clear_record_transaction_mac@32 @950 + desfire_check_write_record_transaction_mac = desfire_check_write_record_transaction_mac@44 @951 + dfl_change_file_settings = dfl_change_file_settings@36 @952 + dfl_change_file_settingsM = dfl_change_file_settingsM@40 @953 + dfl_change_file_settings_pk = dfl_change_file_settings_pk@36 @954 + dfl_change_file_settings_pkM = dfl_change_file_settings_pkM@40 @955 + dfl_change_tmc_file_settings = dfl_change_tmc_file_settings@44 @956 + dfl_change_tmc_file_settingsM = dfl_change_tmc_file_settingsM@48 @957 + dfl_change_tmc_file_settings_pk = dfl_change_tmc_file_settings_pk@44 @958 + dfl_change_tmc_file_settings_pkM = dfl_change_tmc_file_settings_pkM@48 @959 + dfl_check_credit_value_transaction_mac = dfl_check_credit_value_transaction_mac@36 @960 + dfl_check_debit_value_transaction_mac = dfl_check_debit_value_transaction_mac@36 @961 + dfl_check_write_record_transaction_mac = dfl_check_write_record_transaction_mac@44 @962 + dfl_delete_tmc_file = dfl_delete_tmc_file@8 @963 + dfl_delete_tmc_fileM = dfl_delete_tmc_fileM@12 @964 + dfl_delete_tmc_file_pk = dfl_delete_tmc_file_pk@8 @965 + dfl_delete_tmc_file_pkM = dfl_delete_tmc_file_pkM@12 @966 + dfl_get_file_settings = dfl_get_file_settings@84 @967 + erase_all_ndef_records = erase_all_ndef_records@4 @968 + erase_all_ndef_recordsM = erase_all_ndef_recordsM@8 @969 + erase_last_ndef_record = erase_last_ndef_record@4 @970 + erase_last_ndef_recordM = erase_last_ndef_recordM@8 @971 + get_ndef_record_count = get_ndef_record_count@16 @972 + get_ndef_record_countM = get_ndef_record_countM@20 @973 + i_block_trans_rcv_chain = i_block_trans_rcv_chain@32 @974 + i_block_trans_rcv_chainM = i_block_trans_rcv_chainM@36 @975 + icode_lock_block = icode_lock_block@12 @976 + icode_lock_blockM = icode_lock_blockM@16 @977 + icode_lock_block_PK = icode_lock_block_PK@12 @978 + icode_lock_block_PK_M = icode_lock_block_PK_M@16 @979 + icode_protect_page = icode_protect_page@28 @980 + icode_protect_pageM = icode_protect_pageM@32 @981 + icode_protect_page_PK = icode_protect_page_PK@28 @982 + icode_protect_page_PK_M = icode_protect_page_PK_M@32 @983 + icode_write_password = icode_write_password@12 @984 + icode_write_passwordM = icode_write_passwordM@16 @985 + icode_write_password_PK = icode_write_password_PK@12 @986 + icode_write_password_PK_M = icode_write_password_PK_M@16 @987 + iso15693_get_multiply_block_security_status = iso15693_get_multiply_block_security_status@12 @988 + iso15693_get_multiply_block_security_statusM = iso15693_get_multiply_block_security_statusM@16 @989 + iso15693_lock_block_no_auth = iso15693_lock_block_no_auth@4 @990 + iso15693_lock_block_no_authM = iso15693_lock_block_no_authM@8 @991 + ndef_card_initialization = ndef_card_initialization@0 @992 + ndef_card_initializationM = ndef_card_initializationM@4 @993 + nt4h_change_key = nt4h_change_key@16 @994 + nt4h_change_keyM = nt4h_change_keyM@20 @995 + nt4h_change_key_pk = nt4h_change_key_pk@16 @996 + nt4h_change_key_pkM = nt4h_change_key_pkM@20 @997 + nt4h_change_sdm_file_settings = nt4h_change_sdm_file_settings@96 @998 + nt4h_change_sdm_file_settingsM = nt4h_change_sdm_file_settingsM@100 @999 + nt4h_change_sdm_file_settings_pk = nt4h_change_sdm_file_settings_pk@96 @1000 + nt4h_change_sdm_file_settings_pkM = nt4h_change_sdm_file_settings_pkM@100 @1001 + nt4h_change_standard_file_settings = nt4h_change_standard_file_settings@36 @1002 + nt4h_change_standard_file_settingsM = nt4h_change_standard_file_settingsM@40 @1003 + nt4h_change_standard_file_settings_pk = nt4h_change_standard_file_settings_pk@36 @1004 + nt4h_change_standard_file_settings_pkM = nt4h_change_standard_file_settings_pkM@40 @1005 + nt4h_check_sdm_mac = nt4h_check_sdm_mac@24 @1006 + nt4h_decrypt_picc_data = nt4h_decrypt_picc_data@20 @1007 + nt4h_decrypt_sdm_enc_file_data = nt4h_decrypt_sdm_enc_file_data@20 @1008 + nt4h_enable_tt = nt4h_enable_tt@8 @1009 + nt4h_enable_ttM = nt4h_enable_ttM@12 @1010 + nt4h_enable_tt_pk = nt4h_enable_tt_pk@8 @1011 + nt4h_enable_tt_pkM = nt4h_enable_tt_pkM@12 @1012 + nt4h_get_file_settings = nt4h_get_file_settings@96 @1013 + nt4h_get_file_settingsM = nt4h_get_file_settingsM@100 @1014 + nt4h_get_sdm_ctr = nt4h_get_sdm_ctr@16 @1015 + nt4h_get_sdm_ctrM = nt4h_get_sdm_ctrM@20 @1016 + nt4h_get_sdm_ctr_no_auth = nt4h_get_sdm_ctr_no_auth@8 @1017 + nt4h_get_sdm_ctr_no_authM = nt4h_get_sdm_ctr_no_authM@12 @1018 + nt4h_get_sdm_ctr_pk = nt4h_get_sdm_ctr_pk@16 @1019 + nt4h_get_sdm_ctr_pkM = nt4h_get_sdm_ctr_pkM@20 @1020 + nt4h_get_tt_status = nt4h_get_tt_status@16 @1021 + nt4h_get_tt_statusM = nt4h_get_tt_statusM@20 @1022 + nt4h_get_tt_status_no_auth = nt4h_get_tt_status_no_auth@8 @1023 + nt4h_get_tt_status_no_authM = nt4h_get_tt_status_no_authM@12 @1024 + nt4h_get_tt_status_pk = nt4h_get_tt_status_pk@16 @1025 + nt4h_get_tt_status_pkM = nt4h_get_tt_status_pkM@20 @1026 + nt4h_get_uid = nt4h_get_uid@12 @1027 + nt4h_get_uidM = nt4h_get_uidM@16 @1028 + nt4h_get_uid_pk = nt4h_get_uid_pk@12 @1029 + nt4h_get_uid_pkM = nt4h_get_uid_pkM@16 @1030 + nt4h_rid_read_ecc_signature = nt4h_rid_read_ecc_signature@20 @1031 + nt4h_rid_read_ecc_signatureM = nt4h_rid_read_ecc_signatureM@24 @1032 + nt4h_rid_read_ecc_signature_pk = nt4h_rid_read_ecc_signature_pk@20 @1033 + nt4h_rid_read_ecc_signature_pkM = nt4h_rid_read_ecc_signature_pkM@24 @1034 + nt4h_set_global_parameters = nt4h_set_global_parameters@12 @1035 + nt4h_set_global_parametersM = nt4h_set_global_parametersM@16 @1036 + nt4h_set_rid = nt4h_set_rid@4 @1037 + nt4h_set_ridM = nt4h_set_ridM@8 @1038 + nt4h_set_rid_pk = nt4h_set_rid_pk@4 @1039 + nt4h_set_rid_pkM = nt4h_set_rid_pkM@8 @1040 + nt4h_tt_change_sdm_file_settings = nt4h_tt_change_sdm_file_settings@104 @1041 + nt4h_tt_change_sdm_file_settingsM = nt4h_tt_change_sdm_file_settingsM@108 @1042 + nt4h_tt_change_sdm_file_settings_pk = nt4h_tt_change_sdm_file_settings_pk@104 @1043 + nt4h_tt_change_sdm_file_settings_pkM = nt4h_tt_change_sdm_file_settings_pkM@108 @1044 + nt4h_tt_get_file_settings = nt4h_tt_get_file_settings@104 @1045 + nt4h_tt_get_file_settingsM = nt4h_tt_get_file_settingsM@108 @1046 + nt4h_unset_rid_pk = nt4h_unset_rid_pk@4 @1047 + open_ISO7816_interface = open_ISO7816_interface@8 @1048 + open_ISO7816_interfaceM = open_ISO7816_interfaceM@12 @1049 + r_block_transceive = r_block_transceive@24 @1050 + r_block_transceiveM = r_block_transceiveM@28 @1051 + read_ndef_record = read_ndef_record@36 @1052 + read_ndef_recordM = read_ndef_recordM@40 @1053 + s_block_deselect = s_block_deselect@4 @1054 + s_block_deselectM = s_block_deselectM@8 @1055 + setCardDetectedCallback = setCardDetectedCallback@4 @1056 + setCardRemovedCallback = setCardRemovedCallback@4 @1057 + setSessionErrorCallback = setSessionErrorCallback@4 @1058 + test_desfire_ver = test_desfire_ver@0 @1059 + test_i_block = test_i_block@0 @1060 + uFR_APDU_Start = uFR_APDU_Start@0 @1061 + uFR_APDU_StartM = uFR_APDU_StartM@4 @1062 + uFR_APDU_Stop = uFR_APDU_Stop@0 @1063 + uFR_APDU_StopM = uFR_APDU_StopM@4 @1064 + uFR_APDU_Transceive = uFR_APDU_Transceive@44 @1065 + uFR_APDU_TransceiveM = uFR_APDU_TransceiveM@48 @1066 + uFR_DESFIRE_Start = uFR_DESFIRE_Start@0 @1067 + uFR_DESFIRE_StartM = uFR_DESFIRE_StartM@4 @1068 + uFR_DESFIRE_Stop = uFR_DESFIRE_Stop@0 @1069 + uFR_DESFIRE_StopM = uFR_DESFIRE_StopM@4 @1070 + uFR_SAM_DesfireChange2k3desKey_2k3desAuth = uFR_SAM_DesfireChange2k3desKey_2k3desAuth@32 @1071 + uFR_SAM_DesfireChange2k3desKey_2k3desAuthM = uFR_SAM_DesfireChange2k3desKey_2k3desAuthM@36 @1072 + uFR_SAM_DesfireChange2k3desKey_DesAuth = uFR_SAM_DesfireChange2k3desKey_DesAuth@32 @1073 + uFR_SAM_DesfireChange2k3desKey_DesAuthM = uFR_SAM_DesfireChange2k3desKey_DesAuthM@36 @1074 + uFR_SAM_DesfireChange3k3desKey_3k3desAuth = uFR_SAM_DesfireChange3k3desKey_3k3desAuth@32 @1075 + uFR_SAM_DesfireChange3k3desKey_3k3desAuthM = uFR_SAM_DesfireChange3k3desKey_3k3desAuthM@36 @1076 + uFR_SAM_DesfireChangeAesKey_AesAuth = uFR_SAM_DesfireChangeAesKey_AesAuth@32 @1077 + uFR_SAM_DesfireChangeDesKey_2k3desAuth = uFR_SAM_DesfireChangeDesKey_2k3desAuth@32 @1078 + uFR_SAM_DesfireChangeDesKey_2k3desAuthM = uFR_SAM_DesfireChangeDesKey_2k3desAuthM@36 @1079 + uFR_SAM_DesfireChangeDesKey_DesAuth = uFR_SAM_DesfireChangeDesKey_DesAuth@32 @1080 + uFR_SAM_DesfireChangeDesKey_DesAuthM = uFR_SAM_DesfireChangeDesKey_DesAuthM@36 @1081 + uFR_SAM_DesfireChangeFileSettings2k3desAuth = uFR_SAM_DesfireChangeFileSettings2k3desAuth@40 @1082 + uFR_SAM_DesfireChangeFileSettings2k3desAuthM = uFR_SAM_DesfireChangeFileSettings2k3desAuthM@44 @1083 + uFR_SAM_DesfireChangeFileSettings3k3desAuth = uFR_SAM_DesfireChangeFileSettings3k3desAuth@40 @1084 + uFR_SAM_DesfireChangeFileSettings3k3desAuthM = uFR_SAM_DesfireChangeFileSettings3k3desAuthM@44 @1085 + uFR_SAM_DesfireChangeFileSettingsAesAuth = uFR_SAM_DesfireChangeFileSettingsAesAuth@40 @1086 + uFR_SAM_DesfireChangeFileSettingsAesAuthM = uFR_SAM_DesfireChangeFileSettingsAesAuthM@44 @1087 + uFR_SAM_DesfireChangeFileSettingsDesAuth = uFR_SAM_DesfireChangeFileSettingsDesAuth@40 @1088 + uFR_SAM_DesfireChangeFileSettingsDesAuthM = uFR_SAM_DesfireChangeFileSettingsDesAuthM@44 @1089 + uFR_SAM_DesfireChangeFileSettingsSdm = uFR_SAM_DesfireChangeFileSettingsSdm@100 @1090 + uFR_SAM_DesfireChangeFileSettingsSdmM = uFR_SAM_DesfireChangeFileSettingsSdmM@104 @1091 + uFR_SAM_DesfireChangeKeySettings2k3desAuth = uFR_SAM_DesfireChangeKeySettings2k3desAuth@20 @1092 + uFR_SAM_DesfireChangeKeySettings2k3desAuthM = uFR_SAM_DesfireChangeKeySettings2k3desAuthM@24 @1093 + uFR_SAM_DesfireChangeKeySettings3k3desAuth = uFR_SAM_DesfireChangeKeySettings3k3desAuth@20 @1094 + uFR_SAM_DesfireChangeKeySettings3k3desAuthM = uFR_SAM_DesfireChangeKeySettings3k3desAuthM@24 @1095 + uFR_SAM_DesfireChangeKeySettingsAesAuth = uFR_SAM_DesfireChangeKeySettingsAesAuth@20 @1096 + uFR_SAM_DesfireChangeKeySettingsAesAuthM = uFR_SAM_DesfireChangeKeySettingsAesAuthM@24 @1097 + uFR_SAM_DesfireChangeKeySettingsDesAuth = uFR_SAM_DesfireChangeKeySettingsDesAuth@20 @1098 + uFR_SAM_DesfireChangeKeySettingsDesAuthM = uFR_SAM_DesfireChangeKeySettingsDesAuthM@24 @1099 + uFR_SAM_DesfireChangeKey_AesAuthM = uFR_SAM_DesfireChangeKey_AesAuthM@36 @1100 + uFR_SAM_DesfireChangeMasterKey = uFR_SAM_DesfireChangeMasterKey@24 @1101 + uFR_SAM_DesfireChangeMasterKeyM = uFR_SAM_DesfireChangeMasterKeyM@28 @1102 + uFR_SAM_DesfireClearRecordFile2k3desAuth = uFR_SAM_DesfireClearRecordFile2k3desAuth@20 @1103 + uFR_SAM_DesfireClearRecordFile2k3desAuth_2 = uFR_SAM_DesfireClearRecordFile2k3desAuth_2@24 @1104 + uFR_SAM_DesfireClearRecordFile2k3desAuth_2M = uFR_SAM_DesfireClearRecordFile2k3desAuth_2M@28 @1105 + uFR_SAM_DesfireClearRecordFile3k3desAuth = uFR_SAM_DesfireClearRecordFile3k3desAuth@20 @1106 + uFR_SAM_DesfireClearRecordFile3k3desAuthM = uFR_SAM_DesfireClearRecordFile3k3desAuthM@24 @1107 + uFR_SAM_DesfireClearRecordFile3k3desAuth_2 = uFR_SAM_DesfireClearRecordFile3k3desAuth_2@24 @1108 + uFR_SAM_DesfireClearRecordFile3k3desAuth_2M = uFR_SAM_DesfireClearRecordFile3k3desAuth_2M@28 @1109 + uFR_SAM_DesfireClearRecordFileAesAuth = uFR_SAM_DesfireClearRecordFileAesAuth@20 @1110 + uFR_SAM_DesfireClearRecordFileAesAuthM = uFR_SAM_DesfireClearRecordFileAesAuthM@24 @1111 + uFR_SAM_DesfireClearRecordFileAesAuth_2 = uFR_SAM_DesfireClearRecordFileAesAuth_2@24 @1112 + uFR_SAM_DesfireClearRecordFileAesAuth_2M = uFR_SAM_DesfireClearRecordFileAesAuth_2M@28 @1113 + uFR_SAM_DesfireClearRecordFileDesAuth = uFR_SAM_DesfireClearRecordFileDesAuth@20 @1114 + uFR_SAM_DesfireClearRecordFileDesAuth_2 = uFR_SAM_DesfireClearRecordFileDesAuth_2@24 @1115 + uFR_SAM_DesfireClearRecordFileDesAuth_2M = uFR_SAM_DesfireClearRecordFileDesAuth_2M@28 @1116 + uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuth = uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuth@44 @1117 + uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM = uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM@48 @1118 + uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuth = uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuth@44 @1119 + uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM = uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM@48 @1120 + uFR_SAM_DesfireClearRecordFile_TransMac_AesAuth = uFR_SAM_DesfireClearRecordFile_TransMac_AesAuth@44 @1121 + uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM = uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM@48 @1122 + uFR_SAM_DesfireClearRecordFile_TransMac_DesAuth = uFR_SAM_DesfireClearRecordFile_TransMac_DesAuth@44 @1123 + uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM = uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM@48 @1124 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuth = uFR_SAM_DesfireCreate3k3desApplication2k3desAuth@24 @1125 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIso = uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIso@36 @1126 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM = uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM@40 @1127 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM = uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM@28 @1128 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuth = uFR_SAM_DesfireCreate3k3desApplication3k3desAuth@24 @1129 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIso = uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIso@36 @1130 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM = uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM@40 @1131 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM = uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM@28 @1132 + uFR_SAM_DesfireCreate3k3desApplicationAesAuth = uFR_SAM_DesfireCreate3k3desApplicationAesAuth@24 @1133 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthIso = uFR_SAM_DesfireCreate3k3desApplicationAesAuthIso@36 @1134 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM = uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM@40 @1135 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthM = uFR_SAM_DesfireCreate3k3desApplicationAesAuthM@28 @1136 + uFR_SAM_DesfireCreate3k3desApplicationDesAuth = uFR_SAM_DesfireCreate3k3desApplicationDesAuth@24 @1137 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthIso = uFR_SAM_DesfireCreate3k3desApplicationDesAuthIso@36 @1138 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM = uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM@40 @1139 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthM = uFR_SAM_DesfireCreate3k3desApplicationDesAuthM@28 @1140 + uFR_SAM_DesfireCreateAesApplication2k3desAuth = uFR_SAM_DesfireCreateAesApplication2k3desAuth@24 @1141 + uFR_SAM_DesfireCreateAesApplication2k3desAuthIso = uFR_SAM_DesfireCreateAesApplication2k3desAuthIso@36 @1142 + uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM = uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM@40 @1143 + uFR_SAM_DesfireCreateAesApplication2k3desAuthM = uFR_SAM_DesfireCreateAesApplication2k3desAuthM@28 @1144 + uFR_SAM_DesfireCreateAesApplication3k3desAuth = uFR_SAM_DesfireCreateAesApplication3k3desAuth@24 @1145 + uFR_SAM_DesfireCreateAesApplication3k3desAuthIso = uFR_SAM_DesfireCreateAesApplication3k3desAuthIso@36 @1146 + uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM = uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM@40 @1147 + uFR_SAM_DesfireCreateAesApplication3k3desAuthM = uFR_SAM_DesfireCreateAesApplication3k3desAuthM@28 @1148 + uFR_SAM_DesfireCreateAesApplicationAesAuth = uFR_SAM_DesfireCreateAesApplicationAesAuth@24 @1149 + uFR_SAM_DesfireCreateAesApplicationAesAuthIso = uFR_SAM_DesfireCreateAesApplicationAesAuthIso@36 @1150 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscd = uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscd@36 @1151 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM = uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM@40 @1152 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM = uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM@40 @1153 + uFR_SAM_DesfireCreateAesApplicationAesAuthM = uFR_SAM_DesfireCreateAesApplicationAesAuthM@28 @1154 + uFR_SAM_DesfireCreateAesApplicationDesAuth = uFR_SAM_DesfireCreateAesApplicationDesAuth@24 @1155 + uFR_SAM_DesfireCreateAesApplicationDesAuthIso = uFR_SAM_DesfireCreateAesApplicationDesAuthIso@36 @1156 + uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM = uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM@40 @1157 + uFR_SAM_DesfireCreateAesApplicationDesAuthM = uFR_SAM_DesfireCreateAesApplicationDesAuthM@28 @1158 + uFR_SAM_DesfireCreateBackupDataFile2k3desAuth = uFR_SAM_DesfireCreateBackupDataFile2k3desAuth@44 @1159 + uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM = uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM@48 @1160 + uFR_SAM_DesfireCreateBackupDataFile3k3desAuth = uFR_SAM_DesfireCreateBackupDataFile3k3desAuth@44 @1161 + uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM = uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM@48 @1162 + uFR_SAM_DesfireCreateBackupDataFileAesAuth = uFR_SAM_DesfireCreateBackupDataFileAesAuth@44 @1163 + uFR_SAM_DesfireCreateBackupDataFileAesAuthM = uFR_SAM_DesfireCreateBackupDataFileAesAuthM@48 @1164 + uFR_SAM_DesfireCreateBackupDataFileDesAuth = uFR_SAM_DesfireCreateBackupDataFileDesAuth@44 @1165 + uFR_SAM_DesfireCreateBackupdDataFileDesAuthM = uFR_SAM_DesfireCreateBackupdDataFileDesAuthM@48 @1166 + uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuth = uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuth@48 @1167 + uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM = uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM@52 @1168 + uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuth = uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuth@48 @1169 + uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM = uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM@52 @1170 + uFR_SAM_DesfireCreateCyclicRecordFileAesAuth = uFR_SAM_DesfireCreateCyclicRecordFileAesAuth@48 @1171 + uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM = uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM@52 @1172 + uFR_SAM_DesfireCreateCyclicRecordFileDesAuth = uFR_SAM_DesfireCreateCyclicRecordFileDesAuth@48 @1173 + uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM = uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM@52 @1174 + uFR_SAM_DesfireCreateDesApplication2k3desAuth = uFR_SAM_DesfireCreateDesApplication2k3desAuth@24 @1175 + uFR_SAM_DesfireCreateDesApplication2k3desAuthIso = uFR_SAM_DesfireCreateDesApplication2k3desAuthIso@36 @1176 + uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM = uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM@40 @1177 + uFR_SAM_DesfireCreateDesApplication2k3desAuthM = uFR_SAM_DesfireCreateDesApplication2k3desAuthM@28 @1178 + uFR_SAM_DesfireCreateDesApplication3k3desAuth = uFR_SAM_DesfireCreateDesApplication3k3desAuth@24 @1179 + uFR_SAM_DesfireCreateDesApplication3k3desAuthIso = uFR_SAM_DesfireCreateDesApplication3k3desAuthIso@36 @1180 + uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM = uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM@40 @1181 + uFR_SAM_DesfireCreateDesApplication3k3desAuthM = uFR_SAM_DesfireCreateDesApplication3k3desAuthM@28 @1182 + uFR_SAM_DesfireCreateDesApplicationAesAuth = uFR_SAM_DesfireCreateDesApplicationAesAuth@24 @1183 + uFR_SAM_DesfireCreateDesApplicationAesAuthIso = uFR_SAM_DesfireCreateDesApplicationAesAuthIso@36 @1184 + uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM = uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM@40 @1185 + uFR_SAM_DesfireCreateDesApplicationAesAuthM = uFR_SAM_DesfireCreateDesApplicationAesAuthM@28 @1186 + uFR_SAM_DesfireCreateDesApplicationDesAuth = uFR_SAM_DesfireCreateDesApplicationDesAuth@24 @1187 + uFR_SAM_DesfireCreateDesApplicationDesAuthIso = uFR_SAM_DesfireCreateDesApplicationDesAuthIso@36 @1188 + uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM = uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM@40 @1189 + uFR_SAM_DesfireCreateDesApplicationDesAuthM = uFR_SAM_DesfireCreateDesApplicationDesAuthM@28 @1190 + uFR_SAM_DesfireCreateLinearRecordFile2k3desAuth = uFR_SAM_DesfireCreateLinearRecordFile2k3desAuth@48 @1191 + uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM = uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM@52 @1192 + uFR_SAM_DesfireCreateLinearRecordFile3k3desAuth = uFR_SAM_DesfireCreateLinearRecordFile3k3desAuth@48 @1193 + uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM = uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM@52 @1194 + uFR_SAM_DesfireCreateLinearRecordFileAesAuth = uFR_SAM_DesfireCreateLinearRecordFileAesAuth@48 @1195 + uFR_SAM_DesfireCreateLinearRecordFileAesAuthM = uFR_SAM_DesfireCreateLinearRecordFileAesAuthM@52 @1196 + uFR_SAM_DesfireCreateLinearRecordFileDesAuth = uFR_SAM_DesfireCreateLinearRecordFileDesAuth@48 @1197 + uFR_SAM_DesfireCreateLinearRecordFileDesAuthM = uFR_SAM_DesfireCreateLinearRecordFileDesAuthM@52 @1198 + uFR_SAM_DesfireCreateStdDataFile2k3desAuth = uFR_SAM_DesfireCreateStdDataFile2k3desAuth@44 @1199 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthIso = uFR_SAM_DesfireCreateStdDataFile2k3desAuthIso@48 @1200 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM = uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM@52 @1201 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthM = uFR_SAM_DesfireCreateStdDataFile2k3desAuthM@48 @1202 + uFR_SAM_DesfireCreateStdDataFile3k3desAuth = uFR_SAM_DesfireCreateStdDataFile3k3desAuth@44 @1203 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthIso = uFR_SAM_DesfireCreateStdDataFile3k3desAuthIso@48 @1204 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM = uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM@52 @1205 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthM = uFR_SAM_DesfireCreateStdDataFile3k3desAuthM@48 @1206 + uFR_SAM_DesfireCreateStdDataFileAesAuth = uFR_SAM_DesfireCreateStdDataFileAesAuth@44 @1207 + uFR_SAM_DesfireCreateStdDataFileAesAuthIso = uFR_SAM_DesfireCreateStdDataFileAesAuthIso@48 @1208 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM = uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM@52 @1209 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdm = uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdm@48 @1210 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM = uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM@52 @1211 + uFR_SAM_DesfireCreateStdDataFileAesAuthM = uFR_SAM_DesfireCreateStdDataFileAesAuthM@48 @1212 + uFR_SAM_DesfireCreateStdDataFileDesAuth = uFR_SAM_DesfireCreateStdDataFileDesAuth@44 @1213 + uFR_SAM_DesfireCreateStdDataFileDesAuthIso = uFR_SAM_DesfireCreateStdDataFileDesAuthIso@48 @1214 + uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM = uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM@52 @1215 + uFR_SAM_DesfireCreateStdDataFileDesAuthM = uFR_SAM_DesfireCreateStdDataFileDesAuthM@48 @1216 + uFR_SAM_DesfireCreateTransMacFile2k3desAuth = uFR_SAM_DesfireCreateTransMacFile2k3desAuth@40 @1217 + uFR_SAM_DesfireCreateTransMacFile2k3desAuthM = uFR_SAM_DesfireCreateTransMacFile2k3desAuthM@44 @1218 + uFR_SAM_DesfireCreateTransMacFile3k3desAuth = uFR_SAM_DesfireCreateTransMacFile3k3desAuth@40 @1219 + uFR_SAM_DesfireCreateTransMacFile3k3desAuthM = uFR_SAM_DesfireCreateTransMacFile3k3desAuthM@44 @1220 + uFR_SAM_DesfireCreateTransMacFileAesAuth = uFR_SAM_DesfireCreateTransMacFileAesAuth@40 @1221 + uFR_SAM_DesfireCreateTransMacFileAesAuthM = uFR_SAM_DesfireCreateTransMacFileAesAuthM@44 @1222 + uFR_SAM_DesfireCreateTransMacFileDesAuth = uFR_SAM_DesfireCreateTransMacFileDesAuth@40 @1223 + uFR_SAM_DesfireCreateTransMacFileDesAuthM = uFR_SAM_DesfireCreateTransMacFileDesAuthM@44 @1224 + uFR_SAM_DesfireCreateValueFile2k3desAuth = uFR_SAM_DesfireCreateValueFile2k3desAuth@56 @1225 + uFR_SAM_DesfireCreateValueFile2k3desAuthM = uFR_SAM_DesfireCreateValueFile2k3desAuthM@60 @1226 + uFR_SAM_DesfireCreateValueFile3k3desAuth = uFR_SAM_DesfireCreateValueFile3k3desAuth@56 @1227 + uFR_SAM_DesfireCreateValueFile3k3desAuthM = uFR_SAM_DesfireCreateValueFile3k3desAuthM@60 @1228 + uFR_SAM_DesfireCreateValueFileAesAuth = uFR_SAM_DesfireCreateValueFileAesAuth@56 @1229 + uFR_SAM_DesfireCreateValueFileAesAuthM = uFR_SAM_DesfireCreateValueFileAesAuthM@60 @1230 + uFR_SAM_DesfireCreateValueFileDesAuth = uFR_SAM_DesfireCreateValueFileDesAuth@56 @1231 + uFR_SAM_DesfireCreateValueFileDesAuthM = uFR_SAM_DesfireCreateValueFileDesAuthM@60 @1232 + uFR_SAM_DesfireDecreaseValueFile2k3desAuth = uFR_SAM_DesfireDecreaseValueFile2k3desAuth@32 @1233 + uFR_SAM_DesfireDecreaseValueFile2k3desAuthM = uFR_SAM_DesfireDecreaseValueFile2k3desAuthM@36 @1234 + uFR_SAM_DesfireDecreaseValueFile3k3desAuth = uFR_SAM_DesfireDecreaseValueFile3k3desAuth@32 @1235 + uFR_SAM_DesfireDecreaseValueFile3k3desAuthM = uFR_SAM_DesfireDecreaseValueFile3k3desAuthM@36 @1236 + uFR_SAM_DesfireDecreaseValueFileAesAuth = uFR_SAM_DesfireDecreaseValueFileAesAuth@32 @1237 + uFR_SAM_DesfireDecreaseValueFileAesAuthM = uFR_SAM_DesfireDecreaseValueFileAesAuthM@36 @1238 + uFR_SAM_DesfireDecreaseValueFileDesAuth = uFR_SAM_DesfireDecreaseValueFileDesAuth@32 @1239 + uFR_SAM_DesfireDecreaseValueFileDesAuthM = uFR_SAM_DesfireDecreaseValueFileDesAuthM@36 @1240 + uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuth = uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuth@52 @1241 + uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM = uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM@56 @1242 + uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuth = uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuth@52 @1243 + uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM = uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM@56 @1244 + uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuth = uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuth@52 @1245 + uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM = uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM@56 @1246 + uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuth = uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuth@52 @1247 + uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM = uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM@56 @1248 + uFR_SAM_DesfireDeleteApplication2k3desAuth = uFR_SAM_DesfireDeleteApplication2k3desAuth@16 @1249 + uFR_SAM_DesfireDeleteApplication2k3desAuthM = uFR_SAM_DesfireDeleteApplication2k3desAuthM@20 @1250 + uFR_SAM_DesfireDeleteApplication3k3desAuth = uFR_SAM_DesfireDeleteApplication3k3desAuth@16 @1251 + uFR_SAM_DesfireDeleteApplication3k3desAuthM = uFR_SAM_DesfireDeleteApplication3k3desAuthM@20 @1252 + uFR_SAM_DesfireDeleteApplicationAesAuth = uFR_SAM_DesfireDeleteApplicationAesAuth@16 @1253 + uFR_SAM_DesfireDeleteApplicationAesAuthM = uFR_SAM_DesfireDeleteApplicationAesAuthM@20 @1254 + uFR_SAM_DesfireDeleteApplicationDesAuth = uFR_SAM_DesfireDeleteApplicationDesAuth@16 @1255 + uFR_SAM_DesfireDeleteApplicationDesAuthM = uFR_SAM_DesfireDeleteApplicationDesAuthM@20 @1256 + uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuth = uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuth@16 @1257 + uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM = uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM@20 @1258 + uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuth = uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuth@16 @1259 + uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM = uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM@20 @1260 + uFR_SAM_DesfireDeleteApplication_app_master_AesAuth = uFR_SAM_DesfireDeleteApplication_app_master_AesAuth@16 @1261 + uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM = uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM@20 @1262 + uFR_SAM_DesfireDeleteApplication_app_master_DesAuth = uFR_SAM_DesfireDeleteApplication_app_master_DesAuth@16 @1263 + uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM = uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM@20 @1264 + uFR_SAM_DesfireDeleteFile2k3desAuth = uFR_SAM_DesfireDeleteFile2k3desAuth@20 @1265 + uFR_SAM_DesfireDeleteFile2k3desAuthM = uFR_SAM_DesfireDeleteFile2k3desAuthM@24 @1266 + uFR_SAM_DesfireDeleteFile3k3desAuth = uFR_SAM_DesfireDeleteFile3k3desAuth@20 @1267 + uFR_SAM_DesfireDeleteFile3k3desAuthM = uFR_SAM_DesfireDeleteFile3k3desAuthM@24 @1268 + uFR_SAM_DesfireDeleteFileAesAuth = uFR_SAM_DesfireDeleteFileAesAuth@20 @1269 + uFR_SAM_DesfireDeleteFileAesAuthM = uFR_SAM_DesfireDeleteFileAesAuthM@24 @1270 + uFR_SAM_DesfireDeleteFileDesAuth = uFR_SAM_DesfireDeleteFileDesAuth@20 @1271 + uFR_SAM_DesfireDeleteFileDesAuthM = uFR_SAM_DesfireDeleteFileDesAuthM@24 @1272 + uFR_SAM_DesfireFormatCard2k3desAuth = uFR_SAM_DesfireFormatCard2k3desAuth@12 @1273 + uFR_SAM_DesfireFormatCard2k3desAuthM = uFR_SAM_DesfireFormatCard2k3desAuthM@16 @1274 + uFR_SAM_DesfireFormatCard3k3desAuth = uFR_SAM_DesfireFormatCard3k3desAuth@12 @1275 + uFR_SAM_DesfireFormatCard3k3desAuthM = uFR_SAM_DesfireFormatCard3k3desAuthM@16 @1276 + uFR_SAM_DesfireFormatCardAesAuth = uFR_SAM_DesfireFormatCardAesAuth@12 @1277 + uFR_SAM_DesfireFormatCardAesAuthM = uFR_SAM_DesfireFormatCardAesAuthM@16 @1278 + uFR_SAM_DesfireFormatCardDesAuth = uFR_SAM_DesfireFormatCardDesAuth@12 @1279 + uFR_SAM_DesfireFormatCardDesAuthM = uFR_SAM_DesfireFormatCardDesAuthM@16 @1280 + uFR_SAM_DesfireGetApplicationIds2k3desAuth = uFR_SAM_DesfireGetApplicationIds2k3desAuth@20 @1281 + uFR_SAM_DesfireGetApplicationIds2k3desAuthM = uFR_SAM_DesfireGetApplicationIds2k3desAuthM@24 @1282 + uFR_SAM_DesfireGetApplicationIds3k3desAuth = uFR_SAM_DesfireGetApplicationIds3k3desAuth@20 @1283 + uFR_SAM_DesfireGetApplicationIds3k3desAuthM = uFR_SAM_DesfireGetApplicationIds3k3desAuthM@24 @1284 + uFR_SAM_DesfireGetApplicationIdsAesAuth = uFR_SAM_DesfireGetApplicationIdsAesAuth@20 @1285 + uFR_SAM_DesfireGetApplicationIdsAesAuthM = uFR_SAM_DesfireGetApplicationIdsAesAuthM@24 @1286 + uFR_SAM_DesfireGetApplicationIdsDesAuth = uFR_SAM_DesfireGetApplicationIdsDesAuth@20 @1287 + uFR_SAM_DesfireGetApplicationIdsDesAuthM = uFR_SAM_DesfireGetApplicationIdsDesAuthM@24 @1288 + uFR_SAM_DesfireGetFileSettings2k3desAuth = uFR_SAM_DesfireGetFileSettings2k3desAuth@84 @1289 + uFR_SAM_DesfireGetFileSettings2k3desAuthM = uFR_SAM_DesfireGetFileSettings2k3desAuthM@88 @1290 + uFR_SAM_DesfireGetFileSettings3k3desAuth = uFR_SAM_DesfireGetFileSettings3k3desAuth@84 @1291 + uFR_SAM_DesfireGetFileSettings3k3desAuthM = uFR_SAM_DesfireGetFileSettings3k3desAuthM@88 @1292 + uFR_SAM_DesfireGetFileSettingsAesAuth = uFR_SAM_DesfireGetFileSettingsAesAuth@84 @1293 + uFR_SAM_DesfireGetFileSettingsAesAuthM = uFR_SAM_DesfireGetFileSettingsAesAuthM@88 @1294 + uFR_SAM_DesfireGetFileSettingsDesAuth = uFR_SAM_DesfireGetFileSettingsDesAuth@84 @1295 + uFR_SAM_DesfireGetFileSettingsDesAuthM = uFR_SAM_DesfireGetFileSettingsDesAuthM@88 @1296 + uFR_SAM_DesfireGetFileSettingsSdmAesAuth = uFR_SAM_DesfireGetFileSettingsSdmAesAuth@112 @1297 + uFR_SAM_DesfireGetFileSettingsSdmAesAuthM = uFR_SAM_DesfireGetFileSettingsSdmAesAuthM@116 @1298 + uFR_SAM_DesfireGetKeySettings2k3desAuth = uFR_SAM_DesfireGetKeySettings2k3desAuth@24 @1299 + uFR_SAM_DesfireGetKeySettings2k3desAuthM = uFR_SAM_DesfireGetKeySettings2k3desAuthM@28 @1300 + uFR_SAM_DesfireGetKeySettings3k3desAuth = uFR_SAM_DesfireGetKeySettings3k3desAuth@24 @1301 + uFR_SAM_DesfireGetKeySettings3k3desAuthM = uFR_SAM_DesfireGetKeySettings3k3desAuthM@28 @1302 + uFR_SAM_DesfireGetKeySettingsAesAuth = uFR_SAM_DesfireGetKeySettingsAesAuth@24 @1303 + uFR_SAM_DesfireGetKeySettingsAesAuthM = uFR_SAM_DesfireGetKeySettingsAesAuthM@28 @1304 + uFR_SAM_DesfireGetKeySettingsDesAuth = uFR_SAM_DesfireGetKeySettingsDesAuth@24 @1305 + uFR_SAM_DesfireGetKeySettingsDesAuthM = uFR_SAM_DesfireGetKeySettingsDesAuthM@28 @1306 + uFR_SAM_DesfireGetStdFileSize2k3desAuth = uFR_SAM_DesfireGetStdFileSize2k3desAuth@24 @1307 + uFR_SAM_DesfireGetStdFileSize2k3desAuthM = uFR_SAM_DesfireGetStdFileSize2k3desAuthM@28 @1308 + uFR_SAM_DesfireGetStdFileSize3k3desAuth = uFR_SAM_DesfireGetStdFileSize3k3desAuth@24 @1309 + uFR_SAM_DesfireGetStdFileSize3k3desAuthM = uFR_SAM_DesfireGetStdFileSize3k3desAuthM@28 @1310 + uFR_SAM_DesfireGetStdFileSizeAesAuth = uFR_SAM_DesfireGetStdFileSizeAesAuth@24 @1311 + uFR_SAM_DesfireGetStdFileSizeAesAuthM = uFR_SAM_DesfireGetStdFileSizeAesAuthM@28 @1312 + uFR_SAM_DesfireGetStdFileSizeDesAuth = uFR_SAM_DesfireGetStdFileSizeDesAuth@24 @1313 + uFR_SAM_DesfireGetStdFileSizeDesAuthM = uFR_SAM_DesfireGetStdFileSizeDesAuthM@28 @1314 + uFR_SAM_DesfireIncreaseValueFile2k3desAuth = uFR_SAM_DesfireIncreaseValueFile2k3desAuth@32 @1315 + uFR_SAM_DesfireIncreaseValueFile2k3desAuthM = uFR_SAM_DesfireIncreaseValueFile2k3desAuthM@36 @1316 + uFR_SAM_DesfireIncreaseValueFile3k3desAuth = uFR_SAM_DesfireIncreaseValueFile3k3desAuth@32 @1317 + uFR_SAM_DesfireIncreaseValueFile3k3desAuthM = uFR_SAM_DesfireIncreaseValueFile3k3desAuthM@36 @1318 + uFR_SAM_DesfireIncreaseValueFileAesAuth = uFR_SAM_DesfireIncreaseValueFileAesAuth@32 @1319 + uFR_SAM_DesfireIncreaseValueFileAesAuthM = uFR_SAM_DesfireIncreaseValueFileAesAuthM@36 @1320 + uFR_SAM_DesfireIncreaseValueFileDesAuth = uFR_SAM_DesfireIncreaseValueFileDesAuth@32 @1321 + uFR_SAM_DesfireIncreaseValueFileDesAuthM = uFR_SAM_DesfireIncreaseValueFileDesAuthM@36 @1322 + uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuth = uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuth@52 @1323 + uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM = uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM@56 @1324 + uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuth = uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuth@52 @1325 + uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM = uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM@56 @1326 + uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuth = uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuth@52 @1327 + uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM = uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM@56 @1328 + uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuth = uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuth@52 @1329 + uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM = uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM@56 @1330 + uFR_SAM_DesfireReadRecords2k3desAuth = uFR_SAM_DesfireReadRecords2k3desAuth@44 @1331 + uFR_SAM_DesfireReadRecords2k3desAuthM = uFR_SAM_DesfireReadRecords2k3desAuthM@48 @1332 + uFR_SAM_DesfireReadRecords3k3desAuth = uFR_SAM_DesfireReadRecords3k3desAuth@44 @1333 + uFR_SAM_DesfireReadRecords3k3desAuthM = uFR_SAM_DesfireReadRecords3k3desAuthM@48 @1334 + uFR_SAM_DesfireReadRecordsAesAuth = uFR_SAM_DesfireReadRecordsAesAuth@44 @1335 + uFR_SAM_DesfireReadRecordsAesAuthM = uFR_SAM_DesfireReadRecordsAesAuthM@48 @1336 + uFR_SAM_DesfireReadRecordsDesAuth = uFR_SAM_DesfireReadRecordsDesAuth@44 @1337 + uFR_SAM_DesfireReadRecordsDesAuthM = uFR_SAM_DesfireReadRecordsDesAuthM@48 @1338 + uFR_SAM_DesfireReadStdDataFile2k3desAuth = uFR_SAM_DesfireReadStdDataFile2k3desAuth@40 @1339 + uFR_SAM_DesfireReadStdDataFile2k3desAuthM = uFR_SAM_DesfireReadStdDataFile2k3desAuthM@44 @1340 + uFR_SAM_DesfireReadStdDataFile3k3desAuth = uFR_SAM_DesfireReadStdDataFile3k3desAuth@40 @1341 + uFR_SAM_DesfireReadStdDataFile3k3desAuthM = uFR_SAM_DesfireReadStdDataFile3k3desAuthM@44 @1342 + uFR_SAM_DesfireReadStdDataFileAesAuth = uFR_SAM_DesfireReadStdDataFileAesAuth@40 @1343 + uFR_SAM_DesfireReadStdDataFileAesAuthM = uFR_SAM_DesfireReadStdDataFileAesAuthM@44 @1344 + uFR_SAM_DesfireReadStdDataFileDesAuth = uFR_SAM_DesfireReadStdDataFileDesAuth@40 @1345 + uFR_SAM_DesfireReadStdDataFileDesAuthM = uFR_SAM_DesfireReadStdDataFileDesAuthM@44 @1346 + uFR_SAM_DesfireReadValueFile2k3desAuth = uFR_SAM_DesfireReadValueFile2k3desAuth@32 @1347 + uFR_SAM_DesfireReadValueFile2k3desAuthM = uFR_SAM_DesfireReadValueFile2k3desAuthM@36 @1348 + uFR_SAM_DesfireReadValueFile3k3desAuth = uFR_SAM_DesfireReadValueFile3k3desAuth@32 @1349 + uFR_SAM_DesfireReadValueFile3k3desAuthM = uFR_SAM_DesfireReadValueFile3k3desAuthM@36 @1350 + uFR_SAM_DesfireReadValueFileAesAuth = uFR_SAM_DesfireReadValueFileAesAuth@32 @1351 + uFR_SAM_DesfireReadValueFileAesAuthM = uFR_SAM_DesfireReadValueFileAesAuthM@36 @1352 + uFR_SAM_DesfireReadValueFileDesAuth = uFR_SAM_DesfireReadValueFileDesAuth@32 @1353 + uFR_SAM_DesfireReadValueFileDesAuthM = uFR_SAM_DesfireReadValueFileDesAuthM@36 @1354 + uFR_SAM_DesfireSetConfiguration2k3desAuth = uFR_SAM_DesfireSetConfiguration2k3desAuth@20 @1355 + uFR_SAM_DesfireSetConfiguration2k3desAuthM = uFR_SAM_DesfireSetConfiguration2k3desAuthM@24 @1356 + uFR_SAM_DesfireSetConfiguration3k3desAuth = uFR_SAM_DesfireSetConfiguration3k3desAuth@20 @1357 + uFR_SAM_DesfireSetConfiguration3k3desAuthM = uFR_SAM_DesfireSetConfiguration3k3desAuthM@24 @1358 + uFR_SAM_DesfireSetConfigurationAesAuth = uFR_SAM_DesfireSetConfigurationAesAuth@20 @1359 + uFR_SAM_DesfireSetConfigurationAesAuthM = uFR_SAM_DesfireSetConfigurationAesAuthM@24 @1360 + uFR_SAM_DesfireSetConfigurationDesAuth = uFR_SAM_DesfireSetConfigurationDesAuth@20 @1361 + uFR_SAM_DesfireSetConfigurationDesAuthM = uFR_SAM_DesfireSetConfigurationDesAuthM@24 @1362 + uFR_SAM_DesfireSetTransactionTimerAesAuth = uFR_SAM_DesfireSetTransactionTimerAesAuth@20 @1363 + uFR_SAM_DesfireSetTransactionTimerAesAuthM = uFR_SAM_DesfireSetTransactionTimerAesAuthM@24 @1364 + uFR_SAM_DesfireWriteBackupDataFile2k3desAuth = uFR_SAM_DesfireWriteBackupDataFile2k3desAuth@40 @1365 + uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM = uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM@44 @1366 + uFR_SAM_DesfireWriteBackupDataFile3k3desAuth = uFR_SAM_DesfireWriteBackupDataFile3k3desAuth@40 @1367 + uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM = uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM@44 @1368 + uFR_SAM_DesfireWriteBackupDataFileAesAuth = uFR_SAM_DesfireWriteBackupDataFileAesAuth@40 @1369 + uFR_SAM_DesfireWriteBackupDataFileAesAuthM = uFR_SAM_DesfireWriteBackupDataFileAesAuthM@44 @1370 + uFR_SAM_DesfireWriteBackupDataFileDesAuth = uFR_SAM_DesfireWriteBackupDataFileDesAuth@40 @1371 + uFR_SAM_DesfireWriteBackupDataFileDesAuthM = uFR_SAM_DesfireWriteBackupDataFileDesAuthM@44 @1372 + uFR_SAM_DesfireWriteRecord2k3desAuth = uFR_SAM_DesfireWriteRecord2k3desAuth@40 @1373 + uFR_SAM_DesfireWriteRecord2k3desAuthM = uFR_SAM_DesfireWriteRecord2k3desAuthM@44 @1374 + uFR_SAM_DesfireWriteRecord3k3desAuth = uFR_SAM_DesfireWriteRecord3k3desAuth@40 @1375 + uFR_SAM_DesfireWriteRecord3k3desAuthM = uFR_SAM_DesfireWriteRecord3k3desAuthM@44 @1376 + uFR_SAM_DesfireWriteRecordAesAuth = uFR_SAM_DesfireWriteRecordAesAuth@40 @1377 + uFR_SAM_DesfireWriteRecordAesAuthM = uFR_SAM_DesfireWriteRecordAesAuthM@44 @1378 + uFR_SAM_DesfireWriteRecordDesAuth = uFR_SAM_DesfireWriteRecordDesAuth@40 @1379 + uFR_SAM_DesfireWriteRecordDesAuthM = uFR_SAM_DesfireWriteRecordDesAuthM@44 @1380 + uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuth = uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuth@60 @1381 + uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM = uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM@64 @1382 + uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuth = uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuth@60 @1383 + uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM = uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM@64 @1384 + uFR_SAM_DesfireWriteRecord_TransMac_AesAuth = uFR_SAM_DesfireWriteRecord_TransMac_AesAuth@60 @1385 + uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM = uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM@64 @1386 + uFR_SAM_DesfireWriteRecord_TransMac_DesAuth = uFR_SAM_DesfireWriteRecord_TransMac_DesAuth@60 @1387 + uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM = uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM@64 @1388 + uFR_SAM_DesfireWriteStdDataFile2k3desAuth = uFR_SAM_DesfireWriteStdDataFile2k3desAuth@40 @1389 + uFR_SAM_DesfireWriteStdDataFile2k3desAuthM = uFR_SAM_DesfireWriteStdDataFile2k3desAuthM@44 @1390 + uFR_SAM_DesfireWriteStdDataFile3k3desAuth = uFR_SAM_DesfireWriteStdDataFile3k3desAuth@40 @1391 + uFR_SAM_DesfireWriteStdDataFile3k3desAuthM = uFR_SAM_DesfireWriteStdDataFile3k3desAuthM@44 @1392 + uFR_SAM_DesfireWriteStdDataFileAesAuth = uFR_SAM_DesfireWriteStdDataFileAesAuth@40 @1393 + uFR_SAM_DesfireWriteStdDataFileAesAuthM = uFR_SAM_DesfireWriteStdDataFileAesAuthM@44 @1394 + uFR_SAM_DesfireWriteStdDataFileDesAuth = uFR_SAM_DesfireWriteStdDataFileDesAuth@40 @1395 + uFR_SAM_DesfireWriteStdDataFileDesAuthM = uFR_SAM_DesfireWriteStdDataFileDesAuthM@44 @1396 + uFR_SAM_GetDesfireUid2k3desAuth = uFR_SAM_GetDesfireUid2k3desAuth@28 @1397 + uFR_SAM_GetDesfireUid2k3desAuthM = uFR_SAM_GetDesfireUid2k3desAuthM@32 @1398 + uFR_SAM_GetDesfireUid3k3desAuth = uFR_SAM_GetDesfireUid3k3desAuth@28 @1399 + uFR_SAM_GetDesfireUid3k3desAuthM = uFR_SAM_GetDesfireUid3k3desAuthM@32 @1400 + uFR_SAM_GetDesfireUidAesAuth = uFR_SAM_GetDesfireUidAesAuth@28 @1401 + uFR_SAM_GetDesfireUidAesAuthM = uFR_SAM_GetDesfireUidAesAuthM@32 @1402 + uFR_SAM_GetDesfireUidDesAuth = uFR_SAM_GetDesfireUidDesAuth@28 @1403 + uFR_SAM_GetDesfireUidDesAuthM = uFR_SAM_GetDesfireUidDesAuthM@32 @1404 + uFR_i_block_transceive = uFR_i_block_transceive@28 @1405 + uFR_i_block_transceiveM = uFR_i_block_transceiveM@32 @1406 + uFR_int_DesfireChange2K3DesKey_2k3des = uFR_int_DesfireChange2K3DesKey_2k3des@32 @1407 + uFR_int_DesfireChange2K3DesKey_2k3desM = uFR_int_DesfireChange2K3DesKey_2k3desM@36 @1408 + uFR_int_DesfireChange2K3DesKey_2k3des_PK = uFR_int_DesfireChange2K3DesKey_2k3des_PK@32 @1409 + uFR_int_DesfireChange2K3DesKey_2k3des_PK_M = uFR_int_DesfireChange2K3DesKey_2k3des_PK_M@36 @1410 + uFR_int_DesfireChange2K3DesKey_des = uFR_int_DesfireChange2K3DesKey_des@32 @1411 + uFR_int_DesfireChange2K3DesKey_desM = uFR_int_DesfireChange2K3DesKey_desM@36 @1412 + uFR_int_DesfireChange2K3DesKey_des_PK = uFR_int_DesfireChange2K3DesKey_des_PK@32 @1413 + uFR_int_DesfireChange2K3DesKey_des_PK_M = uFR_int_DesfireChange2K3DesKey_des_PK_M@36 @1414 + uFR_int_DesfireChange3K3DesKey_3k3des = uFR_int_DesfireChange3K3DesKey_3k3des@32 @1415 + uFR_int_DesfireChange3K3DesKey_3k3desM = uFR_int_DesfireChange3K3DesKey_3k3desM@36 @1416 + uFR_int_DesfireChange3K3DesKey_3k3des_PK = uFR_int_DesfireChange3K3DesKey_3k3des_PK@32 @1417 + uFR_int_DesfireChange3K3DesKey_3k3des_PK_M = uFR_int_DesfireChange3K3DesKey_3k3des_PK_M@36 @1418 + uFR_int_DesfireChangeAesKey = uFR_int_DesfireChangeAesKey@32 @1419 + uFR_int_DesfireChangeAesKeyM = uFR_int_DesfireChangeAesKeyM@36 @1420 + uFR_int_DesfireChangeAesKey_A = uFR_int_DesfireChangeAesKey_A@32 @1421 + uFR_int_DesfireChangeAesKey_PK = uFR_int_DesfireChangeAesKey_PK@32 @1422 + uFR_int_DesfireChangeAesKey_PK_M = uFR_int_DesfireChangeAesKey_PK_M@36 @1423 + uFR_int_DesfireChangeAesKey_aes = uFR_int_DesfireChangeAesKey_aes@32 @1424 + uFR_int_DesfireChangeAesKey_aesM = uFR_int_DesfireChangeAesKey_aesM@36 @1425 + uFR_int_DesfireChangeAesKey_aes_PK = uFR_int_DesfireChangeAesKey_aes_PK@32 @1426 + uFR_int_DesfireChangeAesKey_aes_PK_M = uFR_int_DesfireChangeAesKey_aes_PK_M@36 @1427 + uFR_int_DesfireChangeDesKey_2k3des = uFR_int_DesfireChangeDesKey_2k3des@32 @1428 + uFR_int_DesfireChangeDesKey_2k3desM = uFR_int_DesfireChangeDesKey_2k3desM@36 @1429 + uFR_int_DesfireChangeDesKey_2k3des_PK = uFR_int_DesfireChangeDesKey_2k3des_PK@32 @1430 + uFR_int_DesfireChangeDesKey_2k3des_PK_M = uFR_int_DesfireChangeDesKey_2k3des_PK_M@36 @1431 + uFR_int_DesfireChangeDesKey_des = uFR_int_DesfireChangeDesKey_des@32 @1432 + uFR_int_DesfireChangeDesKey_desM = uFR_int_DesfireChangeDesKey_desM@36 @1433 + uFR_int_DesfireChangeDesKey_des_PK = uFR_int_DesfireChangeDesKey_des_PK@32 @1434 + uFR_int_DesfireChangeDesKey_des_PK_M = uFR_int_DesfireChangeDesKey_des_PK_M@36 @1435 + uFR_int_DesfireChangeFileSettingsSdm = uFR_int_DesfireChangeFileSettingsSdm@100 @1436 + uFR_int_DesfireChangeFileSettingsSdmM = uFR_int_DesfireChangeFileSettingsSdmM@104 @1437 + uFR_int_DesfireChangeFileSettingsSdm_PK = uFR_int_DesfireChangeFileSettingsSdm_PK@100 @1438 + uFR_int_DesfireChangeFileSettingsSdm_PK_M = uFR_int_DesfireChangeFileSettingsSdm_PK_M@104 @1439 + uFR_int_DesfireChangeFileSettings_2k3des = uFR_int_DesfireChangeFileSettings_2k3des@40 @1440 + uFR_int_DesfireChangeFileSettings_2k3desM = uFR_int_DesfireChangeFileSettings_2k3desM@44 @1441 + uFR_int_DesfireChangeFileSettings_2k3des_PK = uFR_int_DesfireChangeFileSettings_2k3des_PK@40 @1442 + uFR_int_DesfireChangeFileSettings_2k3des_PK_M = uFR_int_DesfireChangeFileSettings_2k3des_PK_M@44 @1443 + uFR_int_DesfireChangeFileSettings_3k3des = uFR_int_DesfireChangeFileSettings_3k3des@40 @1444 + uFR_int_DesfireChangeFileSettings_3k3desM = uFR_int_DesfireChangeFileSettings_3k3desM@44 @1445 + uFR_int_DesfireChangeFileSettings_3k3des_PK = uFR_int_DesfireChangeFileSettings_3k3des_PK@40 @1446 + uFR_int_DesfireChangeFileSettings_3k3des_PK_M = uFR_int_DesfireChangeFileSettings_3k3des_PK_M@44 @1447 + uFR_int_DesfireChangeFileSettings_aes = uFR_int_DesfireChangeFileSettings_aes@40 @1448 + uFR_int_DesfireChangeFileSettings_aesM = uFR_int_DesfireChangeFileSettings_aesM@44 @1449 + uFR_int_DesfireChangeFileSettings_aes_PK = uFR_int_DesfireChangeFileSettings_aes_PK@40 @1450 + uFR_int_DesfireChangeFileSettings_aes_PK_M = uFR_int_DesfireChangeFileSettings_aes_PK_M@44 @1451 + uFR_int_DesfireChangeFileSettings_des = uFR_int_DesfireChangeFileSettings_des@40 @1452 + uFR_int_DesfireChangeFileSettings_desM = uFR_int_DesfireChangeFileSettings_desM@44 @1453 + uFR_int_DesfireChangeFileSettings_des_PK = uFR_int_DesfireChangeFileSettings_des_PK@40 @1454 + uFR_int_DesfireChangeFileSettings_des_PK_M = uFR_int_DesfireChangeFileSettings_des_PK_M@44 @1455 + uFR_int_DesfireChangeKeySettings = uFR_int_DesfireChangeKeySettings@20 @1456 + uFR_int_DesfireChangeKeySettingsM = uFR_int_DesfireChangeKeySettingsM@24 @1457 + uFR_int_DesfireChangeKeySettings_2k3des = uFR_int_DesfireChangeKeySettings_2k3des@20 @1458 + uFR_int_DesfireChangeKeySettings_2k3desM = uFR_int_DesfireChangeKeySettings_2k3desM@24 @1459 + uFR_int_DesfireChangeKeySettings_2k3des_PK = uFR_int_DesfireChangeKeySettings_2k3des_PK@20 @1460 + uFR_int_DesfireChangeKeySettings_2k3des_PK_M = uFR_int_DesfireChangeKeySettings_2k3des_PK_M@24 @1461 + uFR_int_DesfireChangeKeySettings_3k3des = uFR_int_DesfireChangeKeySettings_3k3des@20 @1462 + uFR_int_DesfireChangeKeySettings_3k3desM = uFR_int_DesfireChangeKeySettings_3k3desM@24 @1463 + uFR_int_DesfireChangeKeySettings_3k3des_PK = uFR_int_DesfireChangeKeySettings_3k3des_PK@20 @1464 + uFR_int_DesfireChangeKeySettings_3k3des_PK_M = uFR_int_DesfireChangeKeySettings_3k3des_PK_M@24 @1465 + uFR_int_DesfireChangeKeySettings_PK = uFR_int_DesfireChangeKeySettings_PK@20 @1466 + uFR_int_DesfireChangeKeySettings_PK_M = uFR_int_DesfireChangeKeySettings_PK_M@24 @1467 + uFR_int_DesfireChangeKeySettings_aes = uFR_int_DesfireChangeKeySettings_aes@20 @1468 + uFR_int_DesfireChangeKeySettings_aesM = uFR_int_DesfireChangeKeySettings_aesM@24 @1469 + uFR_int_DesfireChangeKeySettings_aes_PK = uFR_int_DesfireChangeKeySettings_aes_PK@20 @1470 + uFR_int_DesfireChangeKeySettings_aes_PK_M = uFR_int_DesfireChangeKeySettings_aes_PK_M@24 @1471 + uFR_int_DesfireChangeKeySettings_des = uFR_int_DesfireChangeKeySettings_des@20 @1472 + uFR_int_DesfireChangeKeySettings_desM = uFR_int_DesfireChangeKeySettings_desM@24 @1473 + uFR_int_DesfireChangeKeySettings_des_PK = uFR_int_DesfireChangeKeySettings_des_PK@20 @1474 + uFR_int_DesfireChangeKeySettings_des_PK_M = uFR_int_DesfireChangeKeySettings_des_PK_M@24 @1475 + uFR_int_DesfireChangeMasterKey = uFR_int_DesfireChangeMasterKey@24 @1476 + uFR_int_DesfireChangeMasterKeyM = uFR_int_DesfireChangeMasterKeyM@28 @1477 + uFR_int_DesfireChangeMasterKey_PK = uFR_int_DesfireChangeMasterKey_PK@24 @1478 + uFR_int_DesfireChangeMasterKey_PK_M = uFR_int_DesfireChangeMasterKey_PK_M@28 @1479 + uFR_int_DesfireClearRecordFile = uFR_int_DesfireClearRecordFile@20 @1480 + uFR_int_DesfireClearRecordFile_2k3des = uFR_int_DesfireClearRecordFile_2k3des@20 @1481 + uFR_int_DesfireClearRecordFile_2k3desM = uFR_int_DesfireClearRecordFile_2k3desM@24 @1482 + uFR_int_DesfireClearRecordFile_2k3des_2 = uFR_int_DesfireClearRecordFile_2k3des_2@24 @1483 + uFR_int_DesfireClearRecordFile_2k3des_2M = uFR_int_DesfireClearRecordFile_2k3des_2M@28 @1484 + uFR_int_DesfireClearRecordFile_2k3des_PK = uFR_int_DesfireClearRecordFile_2k3des_PK@20 @1485 + uFR_int_DesfireClearRecordFile_2k3des_PK_2 = uFR_int_DesfireClearRecordFile_2k3des_PK_2@24 @1486 + uFR_int_DesfireClearRecordFile_2k3des_PK_2M = uFR_int_DesfireClearRecordFile_2k3des_PK_2M@28 @1487 + uFR_int_DesfireClearRecordFile_2k3des_PK_M = uFR_int_DesfireClearRecordFile_2k3des_PK_M@24 @1488 + uFR_int_DesfireClearRecordFile_3k3des = uFR_int_DesfireClearRecordFile_3k3des@20 @1489 + uFR_int_DesfireClearRecordFile_3k3desM = uFR_int_DesfireClearRecordFile_3k3desM@24 @1490 + uFR_int_DesfireClearRecordFile_3k3des_2 = uFR_int_DesfireClearRecordFile_3k3des_2@24 @1491 + uFR_int_DesfireClearRecordFile_3k3des_2M = uFR_int_DesfireClearRecordFile_3k3des_2M@28 @1492 + uFR_int_DesfireClearRecordFile_3k3des_PK = uFR_int_DesfireClearRecordFile_3k3des_PK@20 @1493 + uFR_int_DesfireClearRecordFile_3k3des_PK_2 = uFR_int_DesfireClearRecordFile_3k3des_PK_2@24 @1494 + uFR_int_DesfireClearRecordFile_3k3des_PK_2M = uFR_int_DesfireClearRecordFile_3k3des_PK_2M@28 @1495 + uFR_int_DesfireClearRecordFile_3k3des_PK_M = uFR_int_DesfireClearRecordFile_3k3des_PK_M@24 @1496 + uFR_int_DesfireClearRecordFile_PK = uFR_int_DesfireClearRecordFile_PK@20 @1497 + uFR_int_DesfireClearRecordFile_PK_2 = uFR_int_DesfireClearRecordFile_PK_2@24 @1498 + uFR_int_DesfireClearRecordFile_TransMac_2k3des = uFR_int_DesfireClearRecordFile_TransMac_2k3des@44 @1499 + uFR_int_DesfireClearRecordFile_TransMac_2k3desM = uFR_int_DesfireClearRecordFile_TransMac_2k3desM@48 @1500 + uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK = uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK@44 @1501 + uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M = uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M@48 @1502 + uFR_int_DesfireClearRecordFile_TransMac_3k3des = uFR_int_DesfireClearRecordFile_TransMac_3k3des@44 @1503 + uFR_int_DesfireClearRecordFile_TransMac_3k3desM = uFR_int_DesfireClearRecordFile_TransMac_3k3desM@48 @1504 + uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK = uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK@44 @1505 + uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M = uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M@48 @1506 + uFR_int_DesfireClearRecordFile_TransMac_aes = uFR_int_DesfireClearRecordFile_TransMac_aes@44 @1507 + uFR_int_DesfireClearRecordFile_TransMac_aesM = uFR_int_DesfireClearRecordFile_TransMac_aesM@48 @1508 + uFR_int_DesfireClearRecordFile_TransMac_aes_PK = uFR_int_DesfireClearRecordFile_TransMac_aes_PK@44 @1509 + uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M = uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M@48 @1510 + uFR_int_DesfireClearRecordFile_TransMac_des = uFR_int_DesfireClearRecordFile_TransMac_des@44 @1511 + uFR_int_DesfireClearRecordFile_TransMac_desM = uFR_int_DesfireClearRecordFile_TransMac_desM@48 @1512 + uFR_int_DesfireClearRecordFile_TransMac_des_PK = uFR_int_DesfireClearRecordFile_TransMac_des_PK@44 @1513 + uFR_int_DesfireClearRecordFile_TransMac_des_PK_M = uFR_int_DesfireClearRecordFile_TransMac_des_PK_M@48 @1514 + uFR_int_DesfireClearRecordFile_TransMac_no_auth = uFR_int_DesfireClearRecordFile_TransMac_no_auth@36 @1515 + uFR_int_DesfireClearRecordFile_TransMac_no_auth_M = uFR_int_DesfireClearRecordFile_TransMac_no_auth_M@40 @1516 + uFR_int_DesfireClearRecordFile_aes = uFR_int_DesfireClearRecordFile_aes@20 @1517 + uFR_int_DesfireClearRecordFile_aesM = uFR_int_DesfireClearRecordFile_aesM@24 @1518 + uFR_int_DesfireClearRecordFile_aes_2 = uFR_int_DesfireClearRecordFile_aes_2@24 @1519 + uFR_int_DesfireClearRecordFile_aes_2M = uFR_int_DesfireClearRecordFile_aes_2M@28 @1520 + uFR_int_DesfireClearRecordFile_aes_PK = uFR_int_DesfireClearRecordFile_aes_PK@20 @1521 + uFR_int_DesfireClearRecordFile_aes_PK_2 = uFR_int_DesfireClearRecordFile_aes_PK_2@24 @1522 + uFR_int_DesfireClearRecordFile_aes_PK_2M = uFR_int_DesfireClearRecordFile_aes_PK_2M@28 @1523 + uFR_int_DesfireClearRecordFile_aes_PK_M = uFR_int_DesfireClearRecordFile_aes_PK_M@24 @1524 + uFR_int_DesfireClearRecordFile_des = uFR_int_DesfireClearRecordFile_des@20 @1525 + uFR_int_DesfireClearRecordFile_desM = uFR_int_DesfireClearRecordFile_desM@24 @1526 + uFR_int_DesfireClearRecordFile_des_2 = uFR_int_DesfireClearRecordFile_des_2@24 @1527 + uFR_int_DesfireClearRecordFile_des_2M = uFR_int_DesfireClearRecordFile_des_2M@28 @1528 + uFR_int_DesfireClearRecordFile_des_PK = uFR_int_DesfireClearRecordFile_des_PK@20 @1529 + uFR_int_DesfireClearRecordFile_des_PK_2 = uFR_int_DesfireClearRecordFile_des_PK_2@24 @1530 + uFR_int_DesfireClearRecordFile_des_PK_2M = uFR_int_DesfireClearRecordFile_des_PK_2M@28 @1531 + uFR_int_DesfireClearRecordFile_des_PK_M = uFR_int_DesfireClearRecordFile_des_PK_M@24 @1532 + uFR_int_DesfireClearRecordFile_no_auth = uFR_int_DesfireClearRecordFile_no_auth@16 @1533 + uFR_int_DesfireClearRecordFile_no_authM = uFR_int_DesfireClearRecordFile_no_authM@20 @1534 + uFR_int_DesfireCreate3k3desApplication_2k3des = uFR_int_DesfireCreate3k3desApplication_2k3des@24 @1535 + uFR_int_DesfireCreate3k3desApplication_2k3desM = uFR_int_DesfireCreate3k3desApplication_2k3desM@28 @1536 + uFR_int_DesfireCreate3k3desApplication_2k3des_PK = uFR_int_DesfireCreate3k3desApplication_2k3des_PK@24 @1537 + uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M = uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M@28 @1538 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso = uFR_int_DesfireCreate3k3desApplication_2k3des_iso@36 @1539 + uFR_int_DesfireCreate3k3desApplication_2k3des_isoM = uFR_int_DesfireCreate3k3desApplication_2k3des_isoM@40 @1540 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK = uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK@36 @1541 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M = uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M@40 @1542 + uFR_int_DesfireCreate3k3desApplication_3k3des = uFR_int_DesfireCreate3k3desApplication_3k3des@24 @1543 + uFR_int_DesfireCreate3k3desApplication_3k3desM = uFR_int_DesfireCreate3k3desApplication_3k3desM@28 @1544 + uFR_int_DesfireCreate3k3desApplication_3k3des_PK = uFR_int_DesfireCreate3k3desApplication_3k3des_PK@24 @1545 + uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M = uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M@28 @1546 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso = uFR_int_DesfireCreate3k3desApplication_3k3des_iso@36 @1547 + uFR_int_DesfireCreate3k3desApplication_3k3des_isoM = uFR_int_DesfireCreate3k3desApplication_3k3des_isoM@40 @1548 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK = uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK@36 @1549 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M = uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M@40 @1550 + uFR_int_DesfireCreate3k3desApplication_aes = uFR_int_DesfireCreate3k3desApplication_aes@24 @1551 + uFR_int_DesfireCreate3k3desApplication_aesM = uFR_int_DesfireCreate3k3desApplication_aesM@28 @1552 + uFR_int_DesfireCreate3k3desApplication_aes_PK = uFR_int_DesfireCreate3k3desApplication_aes_PK@24 @1553 + uFR_int_DesfireCreate3k3desApplication_aes_PK_M = uFR_int_DesfireCreate3k3desApplication_aes_PK_M@28 @1554 + uFR_int_DesfireCreate3k3desApplication_aes_iso = uFR_int_DesfireCreate3k3desApplication_aes_iso@36 @1555 + uFR_int_DesfireCreate3k3desApplication_aes_isoM = uFR_int_DesfireCreate3k3desApplication_aes_isoM@40 @1556 + uFR_int_DesfireCreate3k3desApplication_aes_iso_PK = uFR_int_DesfireCreate3k3desApplication_aes_iso_PK@36 @1557 + uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M = uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M@40 @1558 + uFR_int_DesfireCreate3k3desApplication_des = uFR_int_DesfireCreate3k3desApplication_des@24 @1559 + uFR_int_DesfireCreate3k3desApplication_desM = uFR_int_DesfireCreate3k3desApplication_desM@28 @1560 + uFR_int_DesfireCreate3k3desApplication_des_PK = uFR_int_DesfireCreate3k3desApplication_des_PK@24 @1561 + uFR_int_DesfireCreate3k3desApplication_des_PK_M = uFR_int_DesfireCreate3k3desApplication_des_PK_M@28 @1562 + uFR_int_DesfireCreate3k3desApplication_des_iso = uFR_int_DesfireCreate3k3desApplication_des_iso@36 @1563 + uFR_int_DesfireCreate3k3desApplication_des_isoM = uFR_int_DesfireCreate3k3desApplication_des_isoM@40 @1564 + uFR_int_DesfireCreate3k3desApplication_des_iso_PK = uFR_int_DesfireCreate3k3desApplication_des_iso_PK@36 @1565 + uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M = uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M@40 @1566 + uFR_int_DesfireCreate3k3desApplication_no_auth = uFR_int_DesfireCreate3k3desApplication_no_auth@20 @1567 + uFR_int_DesfireCreate3k3desApplication_no_auth_M = uFR_int_DesfireCreate3k3desApplication_no_auth_M@24 @1568 + uFR_int_DesfireCreate3k3desApplication_no_auth_iso = uFR_int_DesfireCreate3k3desApplication_no_auth_iso@32 @1569 + uFR_int_DesfireCreate3k3desApplication_no_auth_isoM = uFR_int_DesfireCreate3k3desApplication_no_auth_isoM@36 @1570 + uFR_int_DesfireCreateAesApplication = uFR_int_DesfireCreateAesApplication@24 @1571 + uFR_int_DesfireCreateAesApplicationM = uFR_int_DesfireCreateAesApplicationM@28 @1572 + uFR_int_DesfireCreateAesApplication_2k3des = uFR_int_DesfireCreateAesApplication_2k3des@24 @1573 + uFR_int_DesfireCreateAesApplication_2k3desM = uFR_int_DesfireCreateAesApplication_2k3desM@28 @1574 + uFR_int_DesfireCreateAesApplication_2k3des_PK = uFR_int_DesfireCreateAesApplication_2k3des_PK@24 @1575 + uFR_int_DesfireCreateAesApplication_2k3des_PK_M = uFR_int_DesfireCreateAesApplication_2k3des_PK_M@28 @1576 + uFR_int_DesfireCreateAesApplication_2k3des_iso = uFR_int_DesfireCreateAesApplication_2k3des_iso@36 @1577 + uFR_int_DesfireCreateAesApplication_2k3des_isoM = uFR_int_DesfireCreateAesApplication_2k3des_isoM@40 @1578 + uFR_int_DesfireCreateAesApplication_2k3des_iso_PK = uFR_int_DesfireCreateAesApplication_2k3des_iso_PK@36 @1579 + uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M = uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M@40 @1580 + uFR_int_DesfireCreateAesApplication_3k3des = uFR_int_DesfireCreateAesApplication_3k3des@24 @1581 + uFR_int_DesfireCreateAesApplication_3k3desM = uFR_int_DesfireCreateAesApplication_3k3desM@28 @1582 + uFR_int_DesfireCreateAesApplication_3k3des_PK = uFR_int_DesfireCreateAesApplication_3k3des_PK@24 @1583 + uFR_int_DesfireCreateAesApplication_3k3des_PK_M = uFR_int_DesfireCreateAesApplication_3k3des_PK_M@28 @1584 + uFR_int_DesfireCreateAesApplication_3k3des_iso = uFR_int_DesfireCreateAesApplication_3k3des_iso@36 @1585 + uFR_int_DesfireCreateAesApplication_3k3des_isoM = uFR_int_DesfireCreateAesApplication_3k3des_isoM@40 @1586 + uFR_int_DesfireCreateAesApplication_3k3des_iso_PK = uFR_int_DesfireCreateAesApplication_3k3des_iso_PK@36 @1587 + uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M = uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M@40 @1588 + uFR_int_DesfireCreateAesApplication_PK = uFR_int_DesfireCreateAesApplication_PK@24 @1589 + uFR_int_DesfireCreateAesApplication_PK_M = uFR_int_DesfireCreateAesApplication_PK_M@28 @1590 + uFR_int_DesfireCreateAesApplication_aes = uFR_int_DesfireCreateAesApplication_aes@24 @1591 + uFR_int_DesfireCreateAesApplication_aesM = uFR_int_DesfireCreateAesApplication_aesM@28 @1592 + uFR_int_DesfireCreateAesApplication_aes_PK = uFR_int_DesfireCreateAesApplication_aes_PK@24 @1593 + uFR_int_DesfireCreateAesApplication_aes_PK_M = uFR_int_DesfireCreateAesApplication_aes_PK_M@28 @1594 + uFR_int_DesfireCreateAesApplication_aes_iso = uFR_int_DesfireCreateAesApplication_aes_iso@36 @1595 + uFR_int_DesfireCreateAesApplication_aes_isoM = uFR_int_DesfireCreateAesApplication_aes_isoM@40 @1596 + uFR_int_DesfireCreateAesApplication_aes_iso_PK = uFR_int_DesfireCreateAesApplication_aes_iso_PK@36 @1597 + uFR_int_DesfireCreateAesApplication_aes_iso_PK_M = uFR_int_DesfireCreateAesApplication_aes_iso_PK_M@40 @1598 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd = uFR_int_DesfireCreateAesApplication_aes_iso_ascd@36 @1599 + uFR_int_DesfireCreateAesApplication_aes_iso_ascdM = uFR_int_DesfireCreateAesApplication_aes_iso_ascdM@40 @1600 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK = uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK@36 @1601 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M = uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M@40 @1602 + uFR_int_DesfireCreateAesApplication_des = uFR_int_DesfireCreateAesApplication_des@24 @1603 + uFR_int_DesfireCreateAesApplication_desM = uFR_int_DesfireCreateAesApplication_desM@28 @1604 + uFR_int_DesfireCreateAesApplication_des_PK = uFR_int_DesfireCreateAesApplication_des_PK@24 @1605 + uFR_int_DesfireCreateAesApplication_des_PK_M = uFR_int_DesfireCreateAesApplication_des_PK_M@28 @1606 + uFR_int_DesfireCreateAesApplication_des_iso = uFR_int_DesfireCreateAesApplication_des_iso@36 @1607 + uFR_int_DesfireCreateAesApplication_des_isoM = uFR_int_DesfireCreateAesApplication_des_isoM@40 @1608 + uFR_int_DesfireCreateAesApplication_des_iso_PK = uFR_int_DesfireCreateAesApplication_des_iso_PK@36 @1609 + uFR_int_DesfireCreateAesApplication_des_iso_PK_M = uFR_int_DesfireCreateAesApplication_des_iso_PK_M@40 @1610 + uFR_int_DesfireCreateAesApplication_no_auth = uFR_int_DesfireCreateAesApplication_no_auth@20 @1611 + uFR_int_DesfireCreateAesApplication_no_auth_M = uFR_int_DesfireCreateAesApplication_no_auth_M@24 @1612 + uFR_int_DesfireCreateAesApplication_no_auth_iso = uFR_int_DesfireCreateAesApplication_no_auth_iso@32 @1613 + uFR_int_DesfireCreateAesApplication_no_auth_isoM = uFR_int_DesfireCreateAesApplication_no_auth_isoM@36 @1614 + uFR_int_DesfireCreateBackupDataFile_2k3des = uFR_int_DesfireCreateBackupDataFile_2k3des@44 @1615 + uFR_int_DesfireCreateBackupDataFile_2k3desM = uFR_int_DesfireCreateBackupDataFile_2k3desM@48 @1616 + uFR_int_DesfireCreateBackupDataFile_2k3des_PK = uFR_int_DesfireCreateBackupDataFile_2k3des_PK@44 @1617 + uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M = uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M@48 @1618 + uFR_int_DesfireCreateBackupDataFile_3k3des = uFR_int_DesfireCreateBackupDataFile_3k3des@44 @1619 + uFR_int_DesfireCreateBackupDataFile_3k3desM = uFR_int_DesfireCreateBackupDataFile_3k3desM@48 @1620 + uFR_int_DesfireCreateBackupDataFile_3k3des_PK = uFR_int_DesfireCreateBackupDataFile_3k3des_PK@44 @1621 + uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M = uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M@48 @1622 + uFR_int_DesfireCreateBackupDataFile_PK = uFR_int_DesfireCreateBackupDataFile_PK@44 @1623 + uFR_int_DesfireCreateBackupDataFile_aes = uFR_int_DesfireCreateBackupDataFile_aes@44 @1624 + uFR_int_DesfireCreateBackupDataFile_aesM = uFR_int_DesfireCreateBackupDataFile_aesM@48 @1625 + uFR_int_DesfireCreateBackupDataFile_aes_PK = uFR_int_DesfireCreateBackupDataFile_aes_PK@44 @1626 + uFR_int_DesfireCreateBackupDataFile_aes_PK_M = uFR_int_DesfireCreateBackupDataFile_aes_PK_M@48 @1627 + uFR_int_DesfireCreateBackupDataFile_des = uFR_int_DesfireCreateBackupDataFile_des@44 @1628 + uFR_int_DesfireCreateBackupDataFile_desM = uFR_int_DesfireCreateBackupDataFile_desM@48 @1629 + uFR_int_DesfireCreateBackupDataFile_des_PK = uFR_int_DesfireCreateBackupDataFile_des_PK@44 @1630 + uFR_int_DesfireCreateBackupDataFile_des_PK_M = uFR_int_DesfireCreateBackupDataFile_des_PK_M@48 @1631 + uFR_int_DesfireCreateBackupDataFile_no_auth = uFR_int_DesfireCreateBackupDataFile_no_auth@40 @1632 + uFR_int_DesfireCreateBackupDataFile_no_auth_M = uFR_int_DesfireCreateBackupDataFile_no_auth_M@44 @1633 + uFR_int_DesfireCreateCyclicRecordFile_2k3des = uFR_int_DesfireCreateCyclicRecordFile_2k3des@48 @1634 + uFR_int_DesfireCreateCyclicRecordFile_2k3desM = uFR_int_DesfireCreateCyclicRecordFile_2k3desM@52 @1635 + uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK = uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK@48 @1636 + uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M = uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M@52 @1637 + uFR_int_DesfireCreateCyclicRecordFile_3k3des = uFR_int_DesfireCreateCyclicRecordFile_3k3des@48 @1638 + uFR_int_DesfireCreateCyclicRecordFile_3k3desM = uFR_int_DesfireCreateCyclicRecordFile_3k3desM@52 @1639 + uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK = uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK@48 @1640 + uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M = uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M@52 @1641 + uFR_int_DesfireCreateCyclicRecordFile_aes = uFR_int_DesfireCreateCyclicRecordFile_aes@48 @1642 + uFR_int_DesfireCreateCyclicRecordFile_aesM = uFR_int_DesfireCreateCyclicRecordFile_aesM@52 @1643 + uFR_int_DesfireCreateCyclicRecordFile_aes_PK = uFR_int_DesfireCreateCyclicRecordFile_aes_PK@48 @1644 + uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M = uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M@52 @1645 + uFR_int_DesfireCreateCyclicRecordFile_des = uFR_int_DesfireCreateCyclicRecordFile_des@48 @1646 + uFR_int_DesfireCreateCyclicRecordFile_desM = uFR_int_DesfireCreateCyclicRecordFile_desM@52 @1647 + uFR_int_DesfireCreateCyclicRecordFile_des_PK = uFR_int_DesfireCreateCyclicRecordFile_des_PK@48 @1648 + uFR_int_DesfireCreateCyclicRecordFile_des_PK_M = uFR_int_DesfireCreateCyclicRecordFile_des_PK_M@52 @1649 + uFR_int_DesfireCreateCyclicRecordFile_no_auth = uFR_int_DesfireCreateCyclicRecordFile_no_auth@44 @1650 + uFR_int_DesfireCreateCyclicRecordFile_no_authM = uFR_int_DesfireCreateCyclicRecordFile_no_authM@48 @1651 + uFR_int_DesfireCreateDesApplication_2k3des = uFR_int_DesfireCreateDesApplication_2k3des@24 @1652 + uFR_int_DesfireCreateDesApplication_2k3desM = uFR_int_DesfireCreateDesApplication_2k3desM@28 @1653 + uFR_int_DesfireCreateDesApplication_2k3des_PK = uFR_int_DesfireCreateDesApplication_2k3des_PK@24 @1654 + uFR_int_DesfireCreateDesApplication_2k3des_PK_M = uFR_int_DesfireCreateDesApplication_2k3des_PK_M@28 @1655 + uFR_int_DesfireCreateDesApplication_2k3des_iso = uFR_int_DesfireCreateDesApplication_2k3des_iso@36 @1656 + uFR_int_DesfireCreateDesApplication_2k3des_isoM = uFR_int_DesfireCreateDesApplication_2k3des_isoM@40 @1657 + uFR_int_DesfireCreateDesApplication_2k3des_iso_PK = uFR_int_DesfireCreateDesApplication_2k3des_iso_PK@36 @1658 + uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M = uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M@40 @1659 + uFR_int_DesfireCreateDesApplication_3k3des = uFR_int_DesfireCreateDesApplication_3k3des@24 @1660 + uFR_int_DesfireCreateDesApplication_3k3desM = uFR_int_DesfireCreateDesApplication_3k3desM@28 @1661 + uFR_int_DesfireCreateDesApplication_3k3des_PK = uFR_int_DesfireCreateDesApplication_3k3des_PK@24 @1662 + uFR_int_DesfireCreateDesApplication_3k3des_PK_M = uFR_int_DesfireCreateDesApplication_3k3des_PK_M@28 @1663 + uFR_int_DesfireCreateDesApplication_3k3des_iso = uFR_int_DesfireCreateDesApplication_3k3des_iso@36 @1664 + uFR_int_DesfireCreateDesApplication_3k3des_isoM = uFR_int_DesfireCreateDesApplication_3k3des_isoM@40 @1665 + uFR_int_DesfireCreateDesApplication_3k3des_iso_PK = uFR_int_DesfireCreateDesApplication_3k3des_iso_PK@36 @1666 + uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M = uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M@40 @1667 + uFR_int_DesfireCreateDesApplication_aes = uFR_int_DesfireCreateDesApplication_aes@24 @1668 + uFR_int_DesfireCreateDesApplication_aesM = uFR_int_DesfireCreateDesApplication_aesM@28 @1669 + uFR_int_DesfireCreateDesApplication_aes_PK = uFR_int_DesfireCreateDesApplication_aes_PK@24 @1670 + uFR_int_DesfireCreateDesApplication_aes_PK_M = uFR_int_DesfireCreateDesApplication_aes_PK_M@28 @1671 + uFR_int_DesfireCreateDesApplication_aes_iso = uFR_int_DesfireCreateDesApplication_aes_iso@36 @1672 + uFR_int_DesfireCreateDesApplication_aes_isoM = uFR_int_DesfireCreateDesApplication_aes_isoM@40 @1673 + uFR_int_DesfireCreateDesApplication_aes_iso_PK = uFR_int_DesfireCreateDesApplication_aes_iso_PK@36 @1674 + uFR_int_DesfireCreateDesApplication_aes_iso_PK_M = uFR_int_DesfireCreateDesApplication_aes_iso_PK_M@40 @1675 + uFR_int_DesfireCreateDesApplication_des = uFR_int_DesfireCreateDesApplication_des@24 @1676 + uFR_int_DesfireCreateDesApplication_desM = uFR_int_DesfireCreateDesApplication_desM@28 @1677 + uFR_int_DesfireCreateDesApplication_des_PK = uFR_int_DesfireCreateDesApplication_des_PK@24 @1678 + uFR_int_DesfireCreateDesApplication_des_PK_M = uFR_int_DesfireCreateDesApplication_des_PK_M@28 @1679 + uFR_int_DesfireCreateDesApplication_des_iso = uFR_int_DesfireCreateDesApplication_des_iso@36 @1680 + uFR_int_DesfireCreateDesApplication_des_isoM = uFR_int_DesfireCreateDesApplication_des_isoM@40 @1681 + uFR_int_DesfireCreateDesApplication_des_iso_PK = uFR_int_DesfireCreateDesApplication_des_iso_PK@36 @1682 + uFR_int_DesfireCreateDesApplication_des_iso_PK_M = uFR_int_DesfireCreateDesApplication_des_iso_PK_M@40 @1683 + uFR_int_DesfireCreateDesApplication_no_auth = uFR_int_DesfireCreateDesApplication_no_auth@20 @1684 + uFR_int_DesfireCreateDesApplication_no_auth_M = uFR_int_DesfireCreateDesApplication_no_auth_M@24 @1685 + uFR_int_DesfireCreateDesApplication_no_auth_iso = uFR_int_DesfireCreateDesApplication_no_auth_iso@32 @1686 + uFR_int_DesfireCreateDesApplication_no_auth_isoM = uFR_int_DesfireCreateDesApplication_no_auth_isoM@36 @1687 + uFR_int_DesfireCreateLinearRecordFile_2k3des = uFR_int_DesfireCreateLinearRecordFile_2k3des@48 @1688 + uFR_int_DesfireCreateLinearRecordFile_2k3desM = uFR_int_DesfireCreateLinearRecordFile_2k3desM@52 @1689 + uFR_int_DesfireCreateLinearRecordFile_2k3des_PK = uFR_int_DesfireCreateLinearRecordFile_2k3des_PK@48 @1690 + uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M = uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M@52 @1691 + uFR_int_DesfireCreateLinearRecordFile_3k3des = uFR_int_DesfireCreateLinearRecordFile_3k3des@48 @1692 + uFR_int_DesfireCreateLinearRecordFile_3k3desM = uFR_int_DesfireCreateLinearRecordFile_3k3desM@52 @1693 + uFR_int_DesfireCreateLinearRecordFile_3k3des_PK = uFR_int_DesfireCreateLinearRecordFile_3k3des_PK@48 @1694 + uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M = uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M@52 @1695 + uFR_int_DesfireCreateLinearRecordFile_aes = uFR_int_DesfireCreateLinearRecordFile_aes@48 @1696 + uFR_int_DesfireCreateLinearRecordFile_aesM = uFR_int_DesfireCreateLinearRecordFile_aesM@52 @1697 + uFR_int_DesfireCreateLinearRecordFile_aes_PK = uFR_int_DesfireCreateLinearRecordFile_aes_PK@48 @1698 + uFR_int_DesfireCreateLinearRecordFile_aes_PK_M = uFR_int_DesfireCreateLinearRecordFile_aes_PK_M@52 @1699 + uFR_int_DesfireCreateLinearRecordFile_des = uFR_int_DesfireCreateLinearRecordFile_des@48 @1700 + uFR_int_DesfireCreateLinearRecordFile_desM = uFR_int_DesfireCreateLinearRecordFile_desM@52 @1701 + uFR_int_DesfireCreateLinearRecordFile_des_PK = uFR_int_DesfireCreateLinearRecordFile_des_PK@48 @1702 + uFR_int_DesfireCreateLinearRecordFile_des_PK_M = uFR_int_DesfireCreateLinearRecordFile_des_PK_M@52 @1703 + uFR_int_DesfireCreateLinearRecordFile_no_auth = uFR_int_DesfireCreateLinearRecordFile_no_auth@44 @1704 + uFR_int_DesfireCreateLinearRecordFile_no_authM = uFR_int_DesfireCreateLinearRecordFile_no_authM@48 @1705 + uFR_int_DesfireCreateStdDataFile = uFR_int_DesfireCreateStdDataFile@44 @1706 + uFR_int_DesfireCreateStdDataFileM = uFR_int_DesfireCreateStdDataFileM@48 @1707 + uFR_int_DesfireCreateStdDataFile_2k3des = uFR_int_DesfireCreateStdDataFile_2k3des@44 @1708 + uFR_int_DesfireCreateStdDataFile_2k3desM = uFR_int_DesfireCreateStdDataFile_2k3desM@48 @1709 + uFR_int_DesfireCreateStdDataFile_2k3des_PK = uFR_int_DesfireCreateStdDataFile_2k3des_PK@44 @1710 + uFR_int_DesfireCreateStdDataFile_2k3des_PK_M = uFR_int_DesfireCreateStdDataFile_2k3des_PK_M@48 @1711 + uFR_int_DesfireCreateStdDataFile_2k3des_iso = uFR_int_DesfireCreateStdDataFile_2k3des_iso@48 @1712 + uFR_int_DesfireCreateStdDataFile_2k3des_isoM = uFR_int_DesfireCreateStdDataFile_2k3des_isoM@52 @1713 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK = uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK@48 @1714 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M = uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M@52 @1715 + uFR_int_DesfireCreateStdDataFile_3k3des = uFR_int_DesfireCreateStdDataFile_3k3des@44 @1716 + uFR_int_DesfireCreateStdDataFile_3k3desM = uFR_int_DesfireCreateStdDataFile_3k3desM@48 @1717 + uFR_int_DesfireCreateStdDataFile_3k3des_PK = uFR_int_DesfireCreateStdDataFile_3k3des_PK@44 @1718 + uFR_int_DesfireCreateStdDataFile_3k3des_PK_M = uFR_int_DesfireCreateStdDataFile_3k3des_PK_M@48 @1719 + uFR_int_DesfireCreateStdDataFile_3k3des_iso = uFR_int_DesfireCreateStdDataFile_3k3des_iso@48 @1720 + uFR_int_DesfireCreateStdDataFile_3k3des_isoM = uFR_int_DesfireCreateStdDataFile_3k3des_isoM@52 @1721 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK = uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK@48 @1722 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M = uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M@52 @1723 + uFR_int_DesfireCreateStdDataFile_PK = uFR_int_DesfireCreateStdDataFile_PK@44 @1724 + uFR_int_DesfireCreateStdDataFile_PK_M = uFR_int_DesfireCreateStdDataFile_PK_M@48 @1725 + uFR_int_DesfireCreateStdDataFile_aes = uFR_int_DesfireCreateStdDataFile_aes@44 @1726 + uFR_int_DesfireCreateStdDataFile_aesM = uFR_int_DesfireCreateStdDataFile_aesM@48 @1727 + uFR_int_DesfireCreateStdDataFile_aes_PK = uFR_int_DesfireCreateStdDataFile_aes_PK@44 @1728 + uFR_int_DesfireCreateStdDataFile_aes_PK_M = uFR_int_DesfireCreateStdDataFile_aes_PK_M@48 @1729 + uFR_int_DesfireCreateStdDataFile_aes_iso = uFR_int_DesfireCreateStdDataFile_aes_iso@48 @1730 + uFR_int_DesfireCreateStdDataFile_aes_isoM = uFR_int_DesfireCreateStdDataFile_aes_isoM@52 @1731 + uFR_int_DesfireCreateStdDataFile_aes_iso_PK = uFR_int_DesfireCreateStdDataFile_aes_iso_PK@48 @1732 + uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M = uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M@52 @1733 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm = uFR_int_DesfireCreateStdDataFile_aes_iso_sdm@48 @1734 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM = uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM@52 @1735 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK = uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK@48 @1736 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M = uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M@52 @1737 + uFR_int_DesfireCreateStdDataFile_des = uFR_int_DesfireCreateStdDataFile_des@44 @1738 + uFR_int_DesfireCreateStdDataFile_desM = uFR_int_DesfireCreateStdDataFile_desM@48 @1739 + uFR_int_DesfireCreateStdDataFile_des_PK = uFR_int_DesfireCreateStdDataFile_des_PK@44 @1740 + uFR_int_DesfireCreateStdDataFile_des_PK_M = uFR_int_DesfireCreateStdDataFile_des_PK_M@48 @1741 + uFR_int_DesfireCreateStdDataFile_des_iso = uFR_int_DesfireCreateStdDataFile_des_iso@48 @1742 + uFR_int_DesfireCreateStdDataFile_des_isoM = uFR_int_DesfireCreateStdDataFile_des_isoM@52 @1743 + uFR_int_DesfireCreateStdDataFile_des_iso_PK = uFR_int_DesfireCreateStdDataFile_des_iso_PK@48 @1744 + uFR_int_DesfireCreateStdDataFile_des_iso_PK_M = uFR_int_DesfireCreateStdDataFile_des_iso_PK_M@52 @1745 + uFR_int_DesfireCreateStdDataFile_no_auth = uFR_int_DesfireCreateStdDataFile_no_auth@40 @1746 + uFR_int_DesfireCreateStdDataFile_no_auth_M = uFR_int_DesfireCreateStdDataFile_no_auth_M@44 @1747 + uFR_int_DesfireCreateStdDataFile_no_auth_iso = uFR_int_DesfireCreateStdDataFile_no_auth_iso@44 @1748 + uFR_int_DesfireCreateStdDataFile_no_auth_isoM = uFR_int_DesfireCreateStdDataFile_no_auth_isoM@48 @1749 + uFR_int_DesfireCreateTransMacFile_2k3des = uFR_int_DesfireCreateTransMacFile_2k3des@40 @1750 + uFR_int_DesfireCreateTransMacFile_2k3des_M = uFR_int_DesfireCreateTransMacFile_2k3des_M@44 @1751 + uFR_int_DesfireCreateTransMacFile_2k3des_PK = uFR_int_DesfireCreateTransMacFile_2k3des_PK@40 @1752 + uFR_int_DesfireCreateTransMacFile_2k3des_PK_M = uFR_int_DesfireCreateTransMacFile_2k3des_PK_M@44 @1753 + uFR_int_DesfireCreateTransMacFile_3k3des = uFR_int_DesfireCreateTransMacFile_3k3des@40 @1754 + uFR_int_DesfireCreateTransMacFile_3k3des_M = uFR_int_DesfireCreateTransMacFile_3k3des_M@44 @1755 + uFR_int_DesfireCreateTransMacFile_3k3des_PK = uFR_int_DesfireCreateTransMacFile_3k3des_PK@40 @1756 + uFR_int_DesfireCreateTransMacFile_3k3des_PK_M = uFR_int_DesfireCreateTransMacFile_3k3des_PK_M@44 @1757 + uFR_int_DesfireCreateTransMacFile_aes = uFR_int_DesfireCreateTransMacFile_aes@40 @1758 + uFR_int_DesfireCreateTransMacFile_aes_M = uFR_int_DesfireCreateTransMacFile_aes_M@44 @1759 + uFR_int_DesfireCreateTransMacFile_aes_PK = uFR_int_DesfireCreateTransMacFile_aes_PK@40 @1760 + uFR_int_DesfireCreateTransMacFile_aes_PK_M = uFR_int_DesfireCreateTransMacFile_aes_PK_M@44 @1761 + uFR_int_DesfireCreateTransMacFile_des = uFR_int_DesfireCreateTransMacFile_des@40 @1762 + uFR_int_DesfireCreateTransMacFile_des_M = uFR_int_DesfireCreateTransMacFile_des_M@44 @1763 + uFR_int_DesfireCreateTransMacFile_des_PK = uFR_int_DesfireCreateTransMacFile_des_PK@40 @1764 + uFR_int_DesfireCreateTransMacFile_des_PK_M = uFR_int_DesfireCreateTransMacFile_des_PK_M@44 @1765 + uFR_int_DesfireCreateValueFile = uFR_int_DesfireCreateValueFile@56 @1766 + uFR_int_DesfireCreateValueFileM = uFR_int_DesfireCreateValueFileM@60 @1767 + uFR_int_DesfireCreateValueFile_2k3des = uFR_int_DesfireCreateValueFile_2k3des@56 @1768 + uFR_int_DesfireCreateValueFile_2k3desM = uFR_int_DesfireCreateValueFile_2k3desM@60 @1769 + uFR_int_DesfireCreateValueFile_2k3des_PK = uFR_int_DesfireCreateValueFile_2k3des_PK@56 @1770 + uFR_int_DesfireCreateValueFile_2k3des_PK_M = uFR_int_DesfireCreateValueFile_2k3des_PK_M@60 @1771 + uFR_int_DesfireCreateValueFile_3k3des = uFR_int_DesfireCreateValueFile_3k3des@56 @1772 + uFR_int_DesfireCreateValueFile_3k3desM = uFR_int_DesfireCreateValueFile_3k3desM@60 @1773 + uFR_int_DesfireCreateValueFile_3k3des_PK = uFR_int_DesfireCreateValueFile_3k3des_PK@56 @1774 + uFR_int_DesfireCreateValueFile_3k3des_PK_M = uFR_int_DesfireCreateValueFile_3k3des_PK_M@60 @1775 + uFR_int_DesfireCreateValueFile_PK = uFR_int_DesfireCreateValueFile_PK@56 @1776 + uFR_int_DesfireCreateValueFile_PK_M = uFR_int_DesfireCreateValueFile_PK_M@60 @1777 + uFR_int_DesfireCreateValueFile_aes = uFR_int_DesfireCreateValueFile_aes@56 @1778 + uFR_int_DesfireCreateValueFile_aesM = uFR_int_DesfireCreateValueFile_aesM@60 @1779 + uFR_int_DesfireCreateValueFile_aes_PK = uFR_int_DesfireCreateValueFile_aes_PK@56 @1780 + uFR_int_DesfireCreateValueFile_aes_PK_M = uFR_int_DesfireCreateValueFile_aes_PK_M@60 @1781 + uFR_int_DesfireCreateValueFile_des = uFR_int_DesfireCreateValueFile_des@56 @1782 + uFR_int_DesfireCreateValueFile_desM = uFR_int_DesfireCreateValueFile_desM@60 @1783 + uFR_int_DesfireCreateValueFile_des_PK = uFR_int_DesfireCreateValueFile_des_PK@56 @1784 + uFR_int_DesfireCreateValueFile_des_PK_M = uFR_int_DesfireCreateValueFile_des_PK_M@60 @1785 + uFR_int_DesfireCreateValueFile_no_auth = uFR_int_DesfireCreateValueFile_no_auth@52 @1786 + uFR_int_DesfireCreateValueFile_no_auth_M = uFR_int_DesfireCreateValueFile_no_auth_M@56 @1787 + uFR_int_DesfireDecreaseValueFile = uFR_int_DesfireDecreaseValueFile@32 @1788 + uFR_int_DesfireDecreaseValueFileM = uFR_int_DesfireDecreaseValueFileM@36 @1789 + uFR_int_DesfireDecreaseValueFile_2k3des = uFR_int_DesfireDecreaseValueFile_2k3des@32 @1790 + uFR_int_DesfireDecreaseValueFile_2k3desM = uFR_int_DesfireDecreaseValueFile_2k3desM@36 @1791 + uFR_int_DesfireDecreaseValueFile_2k3des_PK = uFR_int_DesfireDecreaseValueFile_2k3des_PK@32 @1792 + uFR_int_DesfireDecreaseValueFile_2k3des_PK_M = uFR_int_DesfireDecreaseValueFile_2k3des_PK_M@36 @1793 + uFR_int_DesfireDecreaseValueFile_3k3des = uFR_int_DesfireDecreaseValueFile_3k3des@32 @1794 + uFR_int_DesfireDecreaseValueFile_3k3desM = uFR_int_DesfireDecreaseValueFile_3k3desM@36 @1795 + uFR_int_DesfireDecreaseValueFile_3k3des_PK = uFR_int_DesfireDecreaseValueFile_3k3des_PK@32 @1796 + uFR_int_DesfireDecreaseValueFile_3k3des_PK_M = uFR_int_DesfireDecreaseValueFile_3k3des_PK_M@36 @1797 + uFR_int_DesfireDecreaseValueFile_PK = uFR_int_DesfireDecreaseValueFile_PK@32 @1798 + uFR_int_DesfireDecreaseValueFile_PK_M = uFR_int_DesfireDecreaseValueFile_PK_M@36 @1799 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des = uFR_int_DesfireDecreaseValueFile_TransMac_2k3des@52 @1800 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM = uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM@56 @1801 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK = uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK@52 @1802 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M = uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M@56 @1803 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des = uFR_int_DesfireDecreaseValueFile_TransMac_3k3des@52 @1804 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM = uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM@56 @1805 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK = uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK@52 @1806 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M = uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M@56 @1807 + uFR_int_DesfireDecreaseValueFile_TransMac_aes = uFR_int_DesfireDecreaseValueFile_TransMac_aes@52 @1808 + uFR_int_DesfireDecreaseValueFile_TransMac_aesM = uFR_int_DesfireDecreaseValueFile_TransMac_aesM@56 @1809 + uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK = uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK@52 @1810 + uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M = uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M@56 @1811 + uFR_int_DesfireDecreaseValueFile_TransMac_des = uFR_int_DesfireDecreaseValueFile_TransMac_des@52 @1812 + uFR_int_DesfireDecreaseValueFile_TransMac_desM = uFR_int_DesfireDecreaseValueFile_TransMac_desM@56 @1813 + uFR_int_DesfireDecreaseValueFile_TransMac_des_PK = uFR_int_DesfireDecreaseValueFile_TransMac_des_PK@52 @1814 + uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M = uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M@56 @1815 + uFR_int_DesfireDecreaseValueFile_TransMac_no_auth = uFR_int_DesfireDecreaseValueFile_TransMac_no_auth@48 @1816 + uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M = uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M@52 @1817 + uFR_int_DesfireDecreaseValueFile_aes = uFR_int_DesfireDecreaseValueFile_aes@32 @1818 + uFR_int_DesfireDecreaseValueFile_aesM = uFR_int_DesfireDecreaseValueFile_aesM@36 @1819 + uFR_int_DesfireDecreaseValueFile_aes_PK = uFR_int_DesfireDecreaseValueFile_aes_PK@32 @1820 + uFR_int_DesfireDecreaseValueFile_aes_PK_M = uFR_int_DesfireDecreaseValueFile_aes_PK_M@36 @1821 + uFR_int_DesfireDecreaseValueFile_des = uFR_int_DesfireDecreaseValueFile_des@32 @1822 + uFR_int_DesfireDecreaseValueFile_desM = uFR_int_DesfireDecreaseValueFile_desM@36 @1823 + uFR_int_DesfireDecreaseValueFile_des_PK = uFR_int_DesfireDecreaseValueFile_des_PK@32 @1824 + uFR_int_DesfireDecreaseValueFile_des_PK_M = uFR_int_DesfireDecreaseValueFile_des_PK_M@36 @1825 + uFR_int_DesfireDecreaseValueFile_no_auth = uFR_int_DesfireDecreaseValueFile_no_auth@28 @1826 + uFR_int_DesfireDecreaseValueFile_no_auth_M = uFR_int_DesfireDecreaseValueFile_no_auth_M@32 @1827 + uFR_int_DesfireDeleteApplication = uFR_int_DesfireDeleteApplication@16 @1828 + uFR_int_DesfireDeleteApplicationM = uFR_int_DesfireDeleteApplicationM@20 @1829 + uFR_int_DesfireDeleteApplication_2k3des = uFR_int_DesfireDeleteApplication_2k3des@16 @1830 + uFR_int_DesfireDeleteApplication_2k3desM = uFR_int_DesfireDeleteApplication_2k3desM@20 @1831 + uFR_int_DesfireDeleteApplication_2k3des_PK = uFR_int_DesfireDeleteApplication_2k3des_PK@16 @1832 + uFR_int_DesfireDeleteApplication_2k3des_PK_M = uFR_int_DesfireDeleteApplication_2k3des_PK_M@20 @1833 + uFR_int_DesfireDeleteApplication_3k3des = uFR_int_DesfireDeleteApplication_3k3des@16 @1834 + uFR_int_DesfireDeleteApplication_3k3desM = uFR_int_DesfireDeleteApplication_3k3desM@20 @1835 + uFR_int_DesfireDeleteApplication_3k3des_PK = uFR_int_DesfireDeleteApplication_3k3des_PK@16 @1836 + uFR_int_DesfireDeleteApplication_3k3des_PK_M = uFR_int_DesfireDeleteApplication_3k3des_PK_M@20 @1837 + uFR_int_DesfireDeleteApplication_PK = uFR_int_DesfireDeleteApplication_PK@16 @1838 + uFR_int_DesfireDeleteApplication_PK_M = uFR_int_DesfireDeleteApplication_PK_M@20 @1839 + uFR_int_DesfireDeleteApplication_aes = uFR_int_DesfireDeleteApplication_aes@16 @1840 + uFR_int_DesfireDeleteApplication_aesM = uFR_int_DesfireDeleteApplication_aesM@20 @1841 + uFR_int_DesfireDeleteApplication_aes_PK = uFR_int_DesfireDeleteApplication_aes_PK@16 @1842 + uFR_int_DesfireDeleteApplication_aes_PK_M = uFR_int_DesfireDeleteApplication_aes_PK_M@20 @1843 + uFR_int_DesfireDeleteApplication_app_master_2k3des = uFR_int_DesfireDeleteApplication_app_master_2k3des@16 @1844 + uFR_int_DesfireDeleteApplication_app_master_2k3desM = uFR_int_DesfireDeleteApplication_app_master_2k3desM@20 @1845 + uFR_int_DesfireDeleteApplication_app_master_2k3des_PK = uFR_int_DesfireDeleteApplication_app_master_2k3des_PK@16 @1846 + uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M = uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M@20 @1847 + uFR_int_DesfireDeleteApplication_app_master_3k3des = uFR_int_DesfireDeleteApplication_app_master_3k3des@16 @1848 + uFR_int_DesfireDeleteApplication_app_master_3k3desM = uFR_int_DesfireDeleteApplication_app_master_3k3desM@20 @1849 + uFR_int_DesfireDeleteApplication_app_master_3k3des_PK = uFR_int_DesfireDeleteApplication_app_master_3k3des_PK@16 @1850 + uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M = uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M@20 @1851 + uFR_int_DesfireDeleteApplication_app_master_PK = uFR_int_DesfireDeleteApplication_app_master_PK@16 @1852 + uFR_int_DesfireDeleteApplication_app_master_aes = uFR_int_DesfireDeleteApplication_app_master_aes@16 @1853 + uFR_int_DesfireDeleteApplication_app_master_aesM = uFR_int_DesfireDeleteApplication_app_master_aesM@20 @1854 + uFR_int_DesfireDeleteApplication_app_master_aes_PK = uFR_int_DesfireDeleteApplication_app_master_aes_PK@16 @1855 + uFR_int_DesfireDeleteApplication_app_master_aes_PK_M = uFR_int_DesfireDeleteApplication_app_master_aes_PK_M@20 @1856 + uFR_int_DesfireDeleteApplication_app_master_des = uFR_int_DesfireDeleteApplication_app_master_des@16 @1857 + uFR_int_DesfireDeleteApplication_app_master_desM = uFR_int_DesfireDeleteApplication_app_master_desM@20 @1858 + uFR_int_DesfireDeleteApplication_app_master_des_PK = uFR_int_DesfireDeleteApplication_app_master_des_PK@16 @1859 + uFR_int_DesfireDeleteApplication_app_master_des_PK_M = uFR_int_DesfireDeleteApplication_app_master_des_PK_M@20 @1860 + uFR_int_DesfireDeleteApplication_des = uFR_int_DesfireDeleteApplication_des@16 @1861 + uFR_int_DesfireDeleteApplication_desM = uFR_int_DesfireDeleteApplication_desM@20 @1862 + uFR_int_DesfireDeleteApplication_des_PK = uFR_int_DesfireDeleteApplication_des_PK@16 @1863 + uFR_int_DesfireDeleteApplication_des_PK_M = uFR_int_DesfireDeleteApplication_des_PK_M@20 @1864 + uFR_int_DesfireDeleteFile = uFR_int_DesfireDeleteFile@20 @1865 + uFR_int_DesfireDeleteFileM = uFR_int_DesfireDeleteFileM@24 @1866 + uFR_int_DesfireDeleteFile_2k3des = uFR_int_DesfireDeleteFile_2k3des@20 @1867 + uFR_int_DesfireDeleteFile_2k3desM = uFR_int_DesfireDeleteFile_2k3desM@24 @1868 + uFR_int_DesfireDeleteFile_2k3des_PK = uFR_int_DesfireDeleteFile_2k3des_PK@20 @1869 + uFR_int_DesfireDeleteFile_2k3des_PK_M = uFR_int_DesfireDeleteFile_2k3des_PK_M@24 @1870 + uFR_int_DesfireDeleteFile_3k3des = uFR_int_DesfireDeleteFile_3k3des@20 @1871 + uFR_int_DesfireDeleteFile_3k3desM = uFR_int_DesfireDeleteFile_3k3desM@24 @1872 + uFR_int_DesfireDeleteFile_3k3des_PK = uFR_int_DesfireDeleteFile_3k3des_PK@20 @1873 + uFR_int_DesfireDeleteFile_3k3des_PK_M = uFR_int_DesfireDeleteFile_3k3des_PK_M@24 @1874 + uFR_int_DesfireDeleteFile_PK = uFR_int_DesfireDeleteFile_PK@20 @1875 + uFR_int_DesfireDeleteFile_PK_M = uFR_int_DesfireDeleteFile_PK_M@24 @1876 + uFR_int_DesfireDeleteFile_aes = uFR_int_DesfireDeleteFile_aes@20 @1877 + uFR_int_DesfireDeleteFile_aesM = uFR_int_DesfireDeleteFile_aesM@24 @1878 + uFR_int_DesfireDeleteFile_aes_PK = uFR_int_DesfireDeleteFile_aes_PK@20 @1879 + uFR_int_DesfireDeleteFile_aes_PK_M = uFR_int_DesfireDeleteFile_aes_PK_M@24 @1880 + uFR_int_DesfireDeleteFile_des = uFR_int_DesfireDeleteFile_des@20 @1881 + uFR_int_DesfireDeleteFile_desM = uFR_int_DesfireDeleteFile_desM@24 @1882 + uFR_int_DesfireDeleteFile_des_PK = uFR_int_DesfireDeleteFile_des_PK@20 @1883 + uFR_int_DesfireDeleteFile_des_PK_M = uFR_int_DesfireDeleteFile_des_PK_M@24 @1884 + uFR_int_DesfireDeleteFile_no_auth = uFR_int_DesfireDeleteFile_no_auth@16 @1885 + uFR_int_DesfireDeleteFile_no_auth_M = uFR_int_DesfireDeleteFile_no_auth_M@20 @1886 + uFR_int_DesfireFormatCard = uFR_int_DesfireFormatCard@12 @1887 + uFR_int_DesfireFormatCardM = uFR_int_DesfireFormatCardM@16 @1888 + uFR_int_DesfireFormatCard_2k3des = uFR_int_DesfireFormatCard_2k3des@12 @1889 + uFR_int_DesfireFormatCard_2k3desM = uFR_int_DesfireFormatCard_2k3desM@16 @1890 + uFR_int_DesfireFormatCard_2k3des_PK = uFR_int_DesfireFormatCard_2k3des_PK@12 @1891 + uFR_int_DesfireFormatCard_2k3des_PK_M = uFR_int_DesfireFormatCard_2k3des_PK_M@16 @1892 + uFR_int_DesfireFormatCard_3k3des = uFR_int_DesfireFormatCard_3k3des@12 @1893 + uFR_int_DesfireFormatCard_3k3desM = uFR_int_DesfireFormatCard_3k3desM@16 @1894 + uFR_int_DesfireFormatCard_3k3des_PK = uFR_int_DesfireFormatCard_3k3des_PK@12 @1895 + uFR_int_DesfireFormatCard_3k3des_PK_M = uFR_int_DesfireFormatCard_3k3des_PK_M@16 @1896 + uFR_int_DesfireFormatCard_PK = uFR_int_DesfireFormatCard_PK@12 @1897 + uFR_int_DesfireFormatCard_PK_M = uFR_int_DesfireFormatCard_PK_M@16 @1898 + uFR_int_DesfireFormatCard_aes = uFR_int_DesfireFormatCard_aes@12 @1899 + uFR_int_DesfireFormatCard_aesM = uFR_int_DesfireFormatCard_aesM@16 @1900 + uFR_int_DesfireFormatCard_aes_PK = uFR_int_DesfireFormatCard_aes_PK@12 @1901 + uFR_int_DesfireFormatCard_aes_PK_M = uFR_int_DesfireFormatCard_aes_PK_M@16 @1902 + uFR_int_DesfireFormatCard_des = uFR_int_DesfireFormatCard_des@12 @1903 + uFR_int_DesfireFormatCard_desM = uFR_int_DesfireFormatCard_desM@16 @1904 + uFR_int_DesfireFormatCard_des_PK = uFR_int_DesfireFormatCard_des_PK@12 @1905 + uFR_int_DesfireFormatCard_des_PK_M = uFR_int_DesfireFormatCard_des_PK_M@16 @1906 + uFR_int_DesfireFreeMem = uFR_int_DesfireFreeMem@12 @1907 + uFR_int_DesfireFreeMemM = uFR_int_DesfireFreeMemM@16 @1908 + uFR_int_DesfireGetApplicationIds = uFR_int_DesfireGetApplicationIds@20 @1909 + uFR_int_DesfireGetApplicationIdsM = uFR_int_DesfireGetApplicationIdsM@24 @1910 + uFR_int_DesfireGetApplicationIds_2k3des = uFR_int_DesfireGetApplicationIds_2k3des@20 @1911 + uFR_int_DesfireGetApplicationIds_2k3desM = uFR_int_DesfireGetApplicationIds_2k3desM@24 @1912 + uFR_int_DesfireGetApplicationIds_2k3des_PK = uFR_int_DesfireGetApplicationIds_2k3des_PK@20 @1913 + uFR_int_DesfireGetApplicationIds_2k3des_PK_M = uFR_int_DesfireGetApplicationIds_2k3des_PK_M@24 @1914 + uFR_int_DesfireGetApplicationIds_3k3des = uFR_int_DesfireGetApplicationIds_3k3des@20 @1915 + uFR_int_DesfireGetApplicationIds_3k3desM = uFR_int_DesfireGetApplicationIds_3k3desM@24 @1916 + uFR_int_DesfireGetApplicationIds_3k3des_PK = uFR_int_DesfireGetApplicationIds_3k3des_PK@20 @1917 + uFR_int_DesfireGetApplicationIds_3k3des_PK_M = uFR_int_DesfireGetApplicationIds_3k3des_PK_M@24 @1918 + uFR_int_DesfireGetApplicationIds_PK = uFR_int_DesfireGetApplicationIds_PK@20 @1919 + uFR_int_DesfireGetApplicationIds_PK_M = uFR_int_DesfireGetApplicationIds_PK_M@24 @1920 + uFR_int_DesfireGetApplicationIds_aes = uFR_int_DesfireGetApplicationIds_aes@20 @1921 + uFR_int_DesfireGetApplicationIds_aesM = uFR_int_DesfireGetApplicationIds_aesM@24 @1922 + uFR_int_DesfireGetApplicationIds_aes_PK = uFR_int_DesfireGetApplicationIds_aes_PK@20 @1923 + uFR_int_DesfireGetApplicationIds_aes_PK_M = uFR_int_DesfireGetApplicationIds_aes_PK_M@24 @1924 + uFR_int_DesfireGetApplicationIds_des = uFR_int_DesfireGetApplicationIds_des@20 @1925 + uFR_int_DesfireGetApplicationIds_desM = uFR_int_DesfireGetApplicationIds_desM@24 @1926 + uFR_int_DesfireGetApplicationIds_des_PK = uFR_int_DesfireGetApplicationIds_des_PK@20 @1927 + uFR_int_DesfireGetApplicationIds_des_PK_M = uFR_int_DesfireGetApplicationIds_des_PK_M@24 @1928 + uFR_int_DesfireGetApplicationIds_no_auth = uFR_int_DesfireGetApplicationIds_no_auth@16 @1929 + uFR_int_DesfireGetApplicationIds_no_auth_M = uFR_int_DesfireGetApplicationIds_no_auth_M@20 @1930 + uFR_int_DesfireGetFileSettingsSdm_aes = uFR_int_DesfireGetFileSettingsSdm_aes@112 @1931 + uFR_int_DesfireGetFileSettingsSdm_aes_M = uFR_int_DesfireGetFileSettingsSdm_aes_M@116 @1932 + uFR_int_DesfireGetFileSettingsSdm_aes_PK = uFR_int_DesfireGetFileSettingsSdm_aes_PK@112 @1933 + uFR_int_DesfireGetFileSettingsSdm_aes_PK_M = uFR_int_DesfireGetFileSettingsSdm_aes_PK_M@116 @1934 + uFR_int_DesfireGetFileSettings_2k3des = uFR_int_DesfireGetFileSettings_2k3des@84 @1935 + uFR_int_DesfireGetFileSettings_2k3des_M = uFR_int_DesfireGetFileSettings_2k3des_M@88 @1936 + uFR_int_DesfireGetFileSettings_2k3des_PK = uFR_int_DesfireGetFileSettings_2k3des_PK@84 @1937 + uFR_int_DesfireGetFileSettings_2k3des_PK_M = uFR_int_DesfireGetFileSettings_2k3des_PK_M@88 @1938 + uFR_int_DesfireGetFileSettings_3k3des = uFR_int_DesfireGetFileSettings_3k3des@84 @1939 + uFR_int_DesfireGetFileSettings_3k3des_M = uFR_int_DesfireGetFileSettings_3k3des_M@88 @1940 + uFR_int_DesfireGetFileSettings_3k3des_PK = uFR_int_DesfireGetFileSettings_3k3des_PK@84 @1941 + uFR_int_DesfireGetFileSettings_3k3des_PK_M = uFR_int_DesfireGetFileSettings_3k3des_PK_M@88 @1942 + uFR_int_DesfireGetFileSettings_aes = uFR_int_DesfireGetFileSettings_aes@84 @1943 + uFR_int_DesfireGetFileSettings_aes_M = uFR_int_DesfireGetFileSettings_aes_M@88 @1944 + uFR_int_DesfireGetFileSettings_aes_PK = uFR_int_DesfireGetFileSettings_aes_PK@84 @1945 + uFR_int_DesfireGetFileSettings_aes_PK_M = uFR_int_DesfireGetFileSettings_aes_PK_M@88 @1946 + uFR_int_DesfireGetFileSettings_des = uFR_int_DesfireGetFileSettings_des@84 @1947 + uFR_int_DesfireGetFileSettings_des_M = uFR_int_DesfireGetFileSettings_des_M@88 @1948 + uFR_int_DesfireGetFileSettings_des_PK = uFR_int_DesfireGetFileSettings_des_PK@84 @1949 + uFR_int_DesfireGetFileSettings_des_PK_M = uFR_int_DesfireGetFileSettings_des_PK_M@88 @1950 + uFR_int_DesfireGetFileSettings_no_auth = uFR_int_DesfireGetFileSettings_no_auth@80 @1951 + uFR_int_DesfireGetFileSettings_no_auth_M = uFR_int_DesfireGetFileSettings_no_auth_M@84 @1952 + uFR_int_DesfireGetKeySettings = uFR_int_DesfireGetKeySettings@24 @1953 + uFR_int_DesfireGetKeySettingsM = uFR_int_DesfireGetKeySettingsM@28 @1954 + uFR_int_DesfireGetKeySettings_2k3des = uFR_int_DesfireGetKeySettings_2k3des@24 @1955 + uFR_int_DesfireGetKeySettings_2k3desM = uFR_int_DesfireGetKeySettings_2k3desM@28 @1956 + uFR_int_DesfireGetKeySettings_2k3des_PK = uFR_int_DesfireGetKeySettings_2k3des_PK@24 @1957 + uFR_int_DesfireGetKeySettings_2k3des_PK_M = uFR_int_DesfireGetKeySettings_2k3des_PK_M@28 @1958 + uFR_int_DesfireGetKeySettings_3k3des = uFR_int_DesfireGetKeySettings_3k3des@24 @1959 + uFR_int_DesfireGetKeySettings_3k3desM = uFR_int_DesfireGetKeySettings_3k3desM@28 @1960 + uFR_int_DesfireGetKeySettings_3k3des_PK = uFR_int_DesfireGetKeySettings_3k3des_PK@24 @1961 + uFR_int_DesfireGetKeySettings_3k3des_PK_M = uFR_int_DesfireGetKeySettings_3k3des_PK_M@28 @1962 + uFR_int_DesfireGetKeySettings_PK = uFR_int_DesfireGetKeySettings_PK@24 @1963 + uFR_int_DesfireGetKeySettings_PK_M = uFR_int_DesfireGetKeySettings_PK_M@28 @1964 + uFR_int_DesfireGetKeySettings_aes = uFR_int_DesfireGetKeySettings_aes@24 @1965 + uFR_int_DesfireGetKeySettings_aesM = uFR_int_DesfireGetKeySettings_aesM@28 @1966 + uFR_int_DesfireGetKeySettings_aes_PK = uFR_int_DesfireGetKeySettings_aes_PK@24 @1967 + uFR_int_DesfireGetKeySettings_aes_PK_M = uFR_int_DesfireGetKeySettings_aes_PK_M@28 @1968 + uFR_int_DesfireGetKeySettings_des = uFR_int_DesfireGetKeySettings_des@24 @1969 + uFR_int_DesfireGetKeySettings_desM = uFR_int_DesfireGetKeySettings_desM@28 @1970 + uFR_int_DesfireGetKeySettings_des_PK = uFR_int_DesfireGetKeySettings_des_PK@24 @1971 + uFR_int_DesfireGetKeySettings_des_PK_M = uFR_int_DesfireGetKeySettings_des_PK_M@28 @1972 + uFR_int_DesfireGetKeySettings_no_auth = uFR_int_DesfireGetKeySettings_no_auth@20 @1973 + uFR_int_DesfireGetKeySettings_no_auth_M = uFR_int_DesfireGetKeySettings_no_auth_M@24 @1974 + uFR_int_DesfireGetStdFileSize_2k3des = uFR_int_DesfireGetStdFileSize_2k3des@24 @1975 + uFR_int_DesfireGetStdFileSize_2k3des_M = uFR_int_DesfireGetStdFileSize_2k3des_M@28 @1976 + uFR_int_DesfireGetStdFileSize_2k3des_PK = uFR_int_DesfireGetStdFileSize_2k3des_PK@24 @1977 + uFR_int_DesfireGetStdFileSize_2k3des_PK_M = uFR_int_DesfireGetStdFileSize_2k3des_PK_M@28 @1978 + uFR_int_DesfireGetStdFileSize_3k3des = uFR_int_DesfireGetStdFileSize_3k3des@24 @1979 + uFR_int_DesfireGetStdFileSize_3k3des_M = uFR_int_DesfireGetStdFileSize_3k3des_M@28 @1980 + uFR_int_DesfireGetStdFileSize_3k3des_PK = uFR_int_DesfireGetStdFileSize_3k3des_PK@24 @1981 + uFR_int_DesfireGetStdFileSize_3k3des_PK_M = uFR_int_DesfireGetStdFileSize_3k3des_PK_M@28 @1982 + uFR_int_DesfireGetStdFileSize_aes = uFR_int_DesfireGetStdFileSize_aes@24 @1983 + uFR_int_DesfireGetStdFileSize_aes_M = uFR_int_DesfireGetStdFileSize_aes_M@28 @1984 + uFR_int_DesfireGetStdFileSize_aes_PK = uFR_int_DesfireGetStdFileSize_aes_PK@24 @1985 + uFR_int_DesfireGetStdFileSize_aes_PK_M = uFR_int_DesfireGetStdFileSize_aes_PK_M@28 @1986 + uFR_int_DesfireGetStdFileSize_des = uFR_int_DesfireGetStdFileSize_des@24 @1987 + uFR_int_DesfireGetStdFileSize_des_M = uFR_int_DesfireGetStdFileSize_des_M@28 @1988 + uFR_int_DesfireGetStdFileSize_des_PK = uFR_int_DesfireGetStdFileSize_des_PK@24 @1989 + uFR_int_DesfireGetStdFileSize_des_PK_M = uFR_int_DesfireGetStdFileSize_des_PK_M@28 @1990 + uFR_int_DesfireGetStdFileSize_no_auth = uFR_int_DesfireGetStdFileSize_no_auth@20 @1991 + uFR_int_DesfireGetStdFileSize_no_auth_M = uFR_int_DesfireGetStdFileSize_no_auth_M@24 @1992 + uFR_int_DesfireIncreaseValueFile = uFR_int_DesfireIncreaseValueFile@32 @1993 + uFR_int_DesfireIncreaseValueFileM = uFR_int_DesfireIncreaseValueFileM@36 @1994 + uFR_int_DesfireIncreaseValueFile_2k3des = uFR_int_DesfireIncreaseValueFile_2k3des@32 @1995 + uFR_int_DesfireIncreaseValueFile_2k3desM = uFR_int_DesfireIncreaseValueFile_2k3desM@36 @1996 + uFR_int_DesfireIncreaseValueFile_2k3des_PK = uFR_int_DesfireIncreaseValueFile_2k3des_PK@32 @1997 + uFR_int_DesfireIncreaseValueFile_2k3des_PK_M = uFR_int_DesfireIncreaseValueFile_2k3des_PK_M@36 @1998 + uFR_int_DesfireIncreaseValueFile_3k3des = uFR_int_DesfireIncreaseValueFile_3k3des@32 @1999 + uFR_int_DesfireIncreaseValueFile_3k3desM = uFR_int_DesfireIncreaseValueFile_3k3desM@36 @2000 + uFR_int_DesfireIncreaseValueFile_3k3des_PK = uFR_int_DesfireIncreaseValueFile_3k3des_PK@32 @2001 + uFR_int_DesfireIncreaseValueFile_3k3des_PK_M = uFR_int_DesfireIncreaseValueFile_3k3des_PK_M@36 @2002 + uFR_int_DesfireIncreaseValueFile_PK = uFR_int_DesfireIncreaseValueFile_PK@32 @2003 + uFR_int_DesfireIncreaseValueFile_PK_M = uFR_int_DesfireIncreaseValueFile_PK_M@36 @2004 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des = uFR_int_DesfireIncreaseValueFile_TransMac_2k3des@52 @2005 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM = uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM@56 @2006 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK = uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK@52 @2007 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M = uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M@56 @2008 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des = uFR_int_DesfireIncreaseValueFile_TransMac_3k3des@52 @2009 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM = uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM@56 @2010 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK = uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK@52 @2011 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M = uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M@56 @2012 + uFR_int_DesfireIncreaseValueFile_TransMac_aes = uFR_int_DesfireIncreaseValueFile_TransMac_aes@52 @2013 + uFR_int_DesfireIncreaseValueFile_TransMac_aesM = uFR_int_DesfireIncreaseValueFile_TransMac_aesM@56 @2014 + uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK = uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK@52 @2015 + uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M = uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M@56 @2016 + uFR_int_DesfireIncreaseValueFile_TransMac_des = uFR_int_DesfireIncreaseValueFile_TransMac_des@52 @2017 + uFR_int_DesfireIncreaseValueFile_TransMac_desM = uFR_int_DesfireIncreaseValueFile_TransMac_desM@56 @2018 + uFR_int_DesfireIncreaseValueFile_TransMac_des_PK = uFR_int_DesfireIncreaseValueFile_TransMac_des_PK@52 @2019 + uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M = uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M@56 @2020 + uFR_int_DesfireIncreaseValueFile_TransMac_no_auth = uFR_int_DesfireIncreaseValueFile_TransMac_no_auth@48 @2021 + uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M = uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M@52 @2022 + uFR_int_DesfireIncreaseValueFile_aes = uFR_int_DesfireIncreaseValueFile_aes@32 @2023 + uFR_int_DesfireIncreaseValueFile_aesM = uFR_int_DesfireIncreaseValueFile_aesM@36 @2024 + uFR_int_DesfireIncreaseValueFile_aes_PK = uFR_int_DesfireIncreaseValueFile_aes_PK@32 @2025 + uFR_int_DesfireIncreaseValueFile_aes_PK_M = uFR_int_DesfireIncreaseValueFile_aes_PK_M@36 @2026 + uFR_int_DesfireIncreaseValueFile_des = uFR_int_DesfireIncreaseValueFile_des@32 @2027 + uFR_int_DesfireIncreaseValueFile_desM = uFR_int_DesfireIncreaseValueFile_desM@36 @2028 + uFR_int_DesfireIncreaseValueFile_des_PK = uFR_int_DesfireIncreaseValueFile_des_PK@32 @2029 + uFR_int_DesfireIncreaseValueFile_des_PK_M = uFR_int_DesfireIncreaseValueFile_des_PK_M@36 @2030 + uFR_int_DesfireIncreaseValueFile_no_auth = uFR_int_DesfireIncreaseValueFile_no_auth@28 @2031 + uFR_int_DesfireIncreaseValueFile_no_auth_M = uFR_int_DesfireIncreaseValueFile_no_auth_M@32 @2032 + uFR_int_DesfireNDEFFormat = uFR_int_DesfireNDEFFormat@4 @2033 + uFR_int_DesfireReadNDEFMessage = uFR_int_DesfireReadNDEFMessage@8 @2034 + uFR_int_DesfireReadNDEFPayload = uFR_int_DesfireReadNDEFPayload@4 @2035 + uFR_int_DesfireReadRecords_2k3des = uFR_int_DesfireReadRecords_2k3des@44 @2036 + uFR_int_DesfireReadRecords_2k3desM = uFR_int_DesfireReadRecords_2k3desM@48 @2037 + uFR_int_DesfireReadRecords_2k3des_PK = uFR_int_DesfireReadRecords_2k3des_PK@44 @2038 + uFR_int_DesfireReadRecords_2k3des_PK_M = uFR_int_DesfireReadRecords_2k3des_PK_M@48 @2039 + uFR_int_DesfireReadRecords_3k3des = uFR_int_DesfireReadRecords_3k3des@44 @2040 + uFR_int_DesfireReadRecords_3k3desM = uFR_int_DesfireReadRecords_3k3desM@48 @2041 + uFR_int_DesfireReadRecords_3k3des_PK = uFR_int_DesfireReadRecords_3k3des_PK@44 @2042 + uFR_int_DesfireReadRecords_3k3des_PK_M = uFR_int_DesfireReadRecords_3k3des_PK_M@48 @2043 + uFR_int_DesfireReadRecords_aes = uFR_int_DesfireReadRecords_aes@44 @2044 + uFR_int_DesfireReadRecords_aesM = uFR_int_DesfireReadRecords_aesM@48 @2045 + uFR_int_DesfireReadRecords_aes_PK = uFR_int_DesfireReadRecords_aes_PK@44 @2046 + uFR_int_DesfireReadRecords_aes_PK_M = uFR_int_DesfireReadRecords_aes_PK_M@48 @2047 + uFR_int_DesfireReadRecords_des = uFR_int_DesfireReadRecords_des@44 @2048 + uFR_int_DesfireReadRecords_desM = uFR_int_DesfireReadRecords_desM@48 @2049 + uFR_int_DesfireReadRecords_des_PK = uFR_int_DesfireReadRecords_des_PK@44 @2050 + uFR_int_DesfireReadRecords_des_PK_M = uFR_int_DesfireReadRecords_des_PK_M@48 @2051 + uFR_int_DesfireReadRecords_no_auth = uFR_int_DesfireReadRecords_no_auth@40 @2052 + uFR_int_DesfireReadRecords_no_authM = uFR_int_DesfireReadRecords_no_authM@44 @2053 + uFR_int_DesfireReadStdDataFile = uFR_int_DesfireReadStdDataFile@40 @2054 + uFR_int_DesfireReadStdDataFile_2k3des = uFR_int_DesfireReadStdDataFile_2k3des@40 @2055 + uFR_int_DesfireReadStdDataFile_2k3desM = uFR_int_DesfireReadStdDataFile_2k3desM@44 @2056 + uFR_int_DesfireReadStdDataFile_2k3des_PK = uFR_int_DesfireReadStdDataFile_2k3des_PK@40 @2057 + uFR_int_DesfireReadStdDataFile_2k3des_PK_M = uFR_int_DesfireReadStdDataFile_2k3des_PK_M@44 @2058 + uFR_int_DesfireReadStdDataFile_3k3des = uFR_int_DesfireReadStdDataFile_3k3des@40 @2059 + uFR_int_DesfireReadStdDataFile_3k3desM = uFR_int_DesfireReadStdDataFile_3k3desM@44 @2060 + uFR_int_DesfireReadStdDataFile_3k3des_PK = uFR_int_DesfireReadStdDataFile_3k3des_PK@40 @2061 + uFR_int_DesfireReadStdDataFile_3k3des_PK_M = uFR_int_DesfireReadStdDataFile_3k3des_PK_M@44 @2062 + uFR_int_DesfireReadStdDataFile_PK = uFR_int_DesfireReadStdDataFile_PK@40 @2063 + uFR_int_DesfireReadStdDataFile_PK_M = uFR_int_DesfireReadStdDataFile_PK_M@44 @2064 + uFR_int_DesfireReadStdDataFile_aes = uFR_int_DesfireReadStdDataFile_aes@40 @2065 + uFR_int_DesfireReadStdDataFile_aesM = uFR_int_DesfireReadStdDataFile_aesM@44 @2066 + uFR_int_DesfireReadStdDataFile_aes_PK = uFR_int_DesfireReadStdDataFile_aes_PK@40 @2067 + uFR_int_DesfireReadStdDataFile_aes_PK_M = uFR_int_DesfireReadStdDataFile_aes_PK_M@44 @2068 + uFR_int_DesfireReadStdDataFile_des = uFR_int_DesfireReadStdDataFile_des@40 @2069 + uFR_int_DesfireReadStdDataFile_desM = uFR_int_DesfireReadStdDataFile_desM@44 @2070 + uFR_int_DesfireReadStdDataFile_des_PK = uFR_int_DesfireReadStdDataFile_des_PK@40 @2071 + uFR_int_DesfireReadStdDataFile_des_PK_M = uFR_int_DesfireReadStdDataFile_des_PK_M@44 @2072 + uFR_int_DesfireReadStdDataFile_no_auth = uFR_int_DesfireReadStdDataFile_no_auth@36 @2073 + uFR_int_DesfireReadStdDataFile_no_auth_M = uFR_int_DesfireReadStdDataFile_no_auth_M@40 @2074 + uFR_int_DesfireReadStddDataFileM = uFR_int_DesfireReadStddDataFileM@44 @2075 + uFR_int_DesfireReadStddDataFile_aesM = uFR_int_DesfireReadStddDataFile_aesM@44 @2076 + uFR_int_DesfireReadValueFile = uFR_int_DesfireReadValueFile@32 @2077 + uFR_int_DesfireReadValueFileM = uFR_int_DesfireReadValueFileM@36 @2078 + uFR_int_DesfireReadValueFile_2k3des = uFR_int_DesfireReadValueFile_2k3des@32 @2079 + uFR_int_DesfireReadValueFile_2k3desM = uFR_int_DesfireReadValueFile_2k3desM@36 @2080 + uFR_int_DesfireReadValueFile_2k3des_PK = uFR_int_DesfireReadValueFile_2k3des_PK@32 @2081 + uFR_int_DesfireReadValueFile_2k3des_PK_M = uFR_int_DesfireReadValueFile_2k3des_PK_M@36 @2082 + uFR_int_DesfireReadValueFile_3k3des = uFR_int_DesfireReadValueFile_3k3des@32 @2083 + uFR_int_DesfireReadValueFile_3k3desM = uFR_int_DesfireReadValueFile_3k3desM@36 @2084 + uFR_int_DesfireReadValueFile_3k3des_PK = uFR_int_DesfireReadValueFile_3k3des_PK@32 @2085 + uFR_int_DesfireReadValueFile_3k3des_PK_M = uFR_int_DesfireReadValueFile_3k3des_PK_M@36 @2086 + uFR_int_DesfireReadValueFile_PK = uFR_int_DesfireReadValueFile_PK@32 @2087 + uFR_int_DesfireReadValueFile_PK_M = uFR_int_DesfireReadValueFile_PK_M@36 @2088 + uFR_int_DesfireReadValueFile_aes = uFR_int_DesfireReadValueFile_aes@32 @2089 + uFR_int_DesfireReadValueFile_aesM = uFR_int_DesfireReadValueFile_aesM@36 @2090 + uFR_int_DesfireReadValueFile_aes_PK = uFR_int_DesfireReadValueFile_aes_PK@32 @2091 + uFR_int_DesfireReadValueFile_aes_PK_M = uFR_int_DesfireReadValueFile_aes_PK_M@36 @2092 + uFR_int_DesfireReadValueFile_des = uFR_int_DesfireReadValueFile_des@32 @2093 + uFR_int_DesfireReadValueFile_desM = uFR_int_DesfireReadValueFile_desM@36 @2094 + uFR_int_DesfireReadValueFile_des_PK = uFR_int_DesfireReadValueFile_des_PK@32 @2095 + uFR_int_DesfireReadValueFile_des_PK_M = uFR_int_DesfireReadValueFile_des_PK_M@36 @2096 + uFR_int_DesfireReadValueFile_no_auth = uFR_int_DesfireReadValueFile_no_auth@28 @2097 + uFR_int_DesfireReadValueFile_no_auth_M = uFR_int_DesfireReadValueFile_no_auth_M@32 @2098 + uFR_int_DesfireRidReadECCSignature_2k3des = uFR_int_DesfireRidReadECCSignature_2k3des@24 @2099 + uFR_int_DesfireRidReadECCSignature_2k3desM = uFR_int_DesfireRidReadECCSignature_2k3desM@28 @2100 + uFR_int_DesfireRidReadECCSignature_2k3des_PK = uFR_int_DesfireRidReadECCSignature_2k3des_PK@24 @2101 + uFR_int_DesfireRidReadECCSignature_2k3des_PK_M = uFR_int_DesfireRidReadECCSignature_2k3des_PK_M@28 @2102 + uFR_int_DesfireRidReadECCSignature_3k3des = uFR_int_DesfireRidReadECCSignature_3k3des@24 @2103 + uFR_int_DesfireRidReadECCSignature_3k3desM = uFR_int_DesfireRidReadECCSignature_3k3desM@28 @2104 + uFR_int_DesfireRidReadECCSignature_3k3des_PK = uFR_int_DesfireRidReadECCSignature_3k3des_PK@24 @2105 + uFR_int_DesfireRidReadECCSignature_3k3des_PK_M = uFR_int_DesfireRidReadECCSignature_3k3des_PK_M@28 @2106 + uFR_int_DesfireRidReadECCSignature_aes = uFR_int_DesfireRidReadECCSignature_aes@24 @2107 + uFR_int_DesfireRidReadECCSignature_aesM = uFR_int_DesfireRidReadECCSignature_aesM@28 @2108 + uFR_int_DesfireRidReadECCSignature_aes_PK = uFR_int_DesfireRidReadECCSignature_aes_PK@24 @2109 + uFR_int_DesfireRidReadECCSignature_aes_PK_M = uFR_int_DesfireRidReadECCSignature_aes_PK_M@28 @2110 + uFR_int_DesfireRidReadECCSignature_des = uFR_int_DesfireRidReadECCSignature_des@24 @2111 + uFR_int_DesfireRidReadECCSignature_desM = uFR_int_DesfireRidReadECCSignature_desM@28 @2112 + uFR_int_DesfireRidReadECCSignature_des_PK = uFR_int_DesfireRidReadECCSignature_des_PK@24 @2113 + uFR_int_DesfireRidReadECCSignature_des_PK_M = uFR_int_DesfireRidReadECCSignature_des_PK_M@28 @2114 + uFR_int_DesfireSetConfiguration = uFR_int_DesfireSetConfiguration@20 @2115 + uFR_int_DesfireSetConfigurationM = uFR_int_DesfireSetConfigurationM@24 @2116 + uFR_int_DesfireSetConfiguration_2k3des = uFR_int_DesfireSetConfiguration_2k3des@20 @2117 + uFR_int_DesfireSetConfiguration_2k3desM = uFR_int_DesfireSetConfiguration_2k3desM@24 @2118 + uFR_int_DesfireSetConfiguration_2k3des_PK = uFR_int_DesfireSetConfiguration_2k3des_PK@20 @2119 + uFR_int_DesfireSetConfiguration_2k3des_PK_M = uFR_int_DesfireSetConfiguration_2k3des_PK_M@24 @2120 + uFR_int_DesfireSetConfiguration_3k3des = uFR_int_DesfireSetConfiguration_3k3des@20 @2121 + uFR_int_DesfireSetConfiguration_3k3desM = uFR_int_DesfireSetConfiguration_3k3desM@24 @2122 + uFR_int_DesfireSetConfiguration_3k3des_PK = uFR_int_DesfireSetConfiguration_3k3des_PK@20 @2123 + uFR_int_DesfireSetConfiguration_3k3des_PK_M = uFR_int_DesfireSetConfiguration_3k3des_PK_M@24 @2124 + uFR_int_DesfireSetConfiguration_PK = uFR_int_DesfireSetConfiguration_PK@20 @2125 + uFR_int_DesfireSetConfiguration_PK_M = uFR_int_DesfireSetConfiguration_PK_M@24 @2126 + uFR_int_DesfireSetConfiguration_aes = uFR_int_DesfireSetConfiguration_aes@20 @2127 + uFR_int_DesfireSetConfiguration_aesM = uFR_int_DesfireSetConfiguration_aesM@24 @2128 + uFR_int_DesfireSetConfiguration_aes_PK = uFR_int_DesfireSetConfiguration_aes_PK@20 @2129 + uFR_int_DesfireSetConfiguration_aes_PK_M = uFR_int_DesfireSetConfiguration_aes_PK_M@24 @2130 + uFR_int_DesfireSetConfiguration_des = uFR_int_DesfireSetConfiguration_des@20 @2131 + uFR_int_DesfireSetConfiguration_desM = uFR_int_DesfireSetConfiguration_desM@24 @2132 + uFR_int_DesfireSetConfiguration_des_PK = uFR_int_DesfireSetConfiguration_des_PK@20 @2133 + uFR_int_DesfireSetConfiguration_des_PK_M = uFR_int_DesfireSetConfiguration_des_PK_M@24 @2134 + uFR_int_DesfireSetTransactionTimer_aes = uFR_int_DesfireSetTransactionTimer_aes@20 @2135 + uFR_int_DesfireSetTransactionTimer_aesM = uFR_int_DesfireSetTransactionTimer_aesM@24 @2136 + uFR_int_DesfireSetTransactionTimer_aes_PK = uFR_int_DesfireSetTransactionTimer_aes_PK@20 @2137 + uFR_int_DesfireSetTransactionTimer_aes_PK_M = uFR_int_DesfireSetTransactionTimer_aes_PK_M@24 @2138 + uFR_int_DesfireUidReadECCSignature = uFR_int_DesfireUidReadECCSignature@12 @2139 + uFR_int_DesfireUidReadECCSignatureM = uFR_int_DesfireUidReadECCSignatureM@16 @2140 + uFR_int_DesfireWriteAesKey = uFR_int_DesfireWriteAesKey@8 @2141 + uFR_int_DesfireWriteAesKeyM = uFR_int_DesfireWriteAesKeyM@12 @2142 + uFR_int_DesfireWriteBackupDataFile_2k3des = uFR_int_DesfireWriteBackupDataFile_2k3des@40 @2143 + uFR_int_DesfireWriteBackupDataFile_2k3desM = uFR_int_DesfireWriteBackupDataFile_2k3desM@44 @2144 + uFR_int_DesfireWriteBackupDataFile_2k3des_PK = uFR_int_DesfireWriteBackupDataFile_2k3des_PK@40 @2145 + uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M = uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M@44 @2146 + uFR_int_DesfireWriteBackupDataFile_3k3des = uFR_int_DesfireWriteBackupDataFile_3k3des@40 @2147 + uFR_int_DesfireWriteBackupDataFile_3k3desM = uFR_int_DesfireWriteBackupDataFile_3k3desM@44 @2148 + uFR_int_DesfireWriteBackupDataFile_3k3des_PK = uFR_int_DesfireWriteBackupDataFile_3k3des_PK@40 @2149 + uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M = uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M@44 @2150 + uFR_int_DesfireWriteBackupDataFile_aes = uFR_int_DesfireWriteBackupDataFile_aes@40 @2151 + uFR_int_DesfireWriteBackupDataFile_aesM = uFR_int_DesfireWriteBackupDataFile_aesM@44 @2152 + uFR_int_DesfireWriteBackupDataFile_aes_PK = uFR_int_DesfireWriteBackupDataFile_aes_PK@40 @2153 + uFR_int_DesfireWriteBackupDataFile_aes_PK_M = uFR_int_DesfireWriteBackupDataFile_aes_PK_M@44 @2154 + uFR_int_DesfireWriteBackupDataFile_des = uFR_int_DesfireWriteBackupDataFile_des@40 @2155 + uFR_int_DesfireWriteBackupDataFile_desM = uFR_int_DesfireWriteBackupDataFile_desM@44 @2156 + uFR_int_DesfireWriteBackupDataFile_des_PK = uFR_int_DesfireWriteBackupDataFile_des_PK@40 @2157 + uFR_int_DesfireWriteBackupDataFile_des_PK_M = uFR_int_DesfireWriteBackupDataFile_des_PK_M@44 @2158 + uFR_int_DesfireWriteBackupDataFile_no_auth = uFR_int_DesfireWriteBackupDataFile_no_auth@36 @2159 + uFR_int_DesfireWriteBackupDataFile_no_auth_M = uFR_int_DesfireWriteBackupDataFile_no_auth_M@40 @2160 + uFR_int_DesfireWriteKey = uFR_int_DesfireWriteKey@12 @2161 + uFR_int_DesfireWriteKeyM = uFR_int_DesfireWriteKeyM@16 @2162 + uFR_int_DesfireWriteNDEFMessage = uFR_int_DesfireWriteNDEFMessage@8 @2163 + uFR_int_DesfireWriteNDEFPayload = uFR_int_DesfireWriteNDEFPayload@4 @2164 + uFR_int_DesfireWriteRecord_2k3des = uFR_int_DesfireWriteRecord_2k3des@40 @2165 + uFR_int_DesfireWriteRecord_2k3desM = uFR_int_DesfireWriteRecord_2k3desM@44 @2166 + uFR_int_DesfireWriteRecord_2k3des_PK = uFR_int_DesfireWriteRecord_2k3des_PK@40 @2167 + uFR_int_DesfireWriteRecord_2k3des_PK_M = uFR_int_DesfireWriteRecord_2k3des_PK_M@44 @2168 + uFR_int_DesfireWriteRecord_3k3des = uFR_int_DesfireWriteRecord_3k3des@40 @2169 + uFR_int_DesfireWriteRecord_3k3desM = uFR_int_DesfireWriteRecord_3k3desM@44 @2170 + uFR_int_DesfireWriteRecord_3k3des_PK = uFR_int_DesfireWriteRecord_3k3des_PK@40 @2171 + uFR_int_DesfireWriteRecord_3k3des_PK_M = uFR_int_DesfireWriteRecord_3k3des_PK_M@44 @2172 + uFR_int_DesfireWriteRecord_TransMac_2k3des = uFR_int_DesfireWriteRecord_TransMac_2k3des@60 @2173 + uFR_int_DesfireWriteRecord_TransMac_2k3desM = uFR_int_DesfireWriteRecord_TransMac_2k3desM@64 @2174 + uFR_int_DesfireWriteRecord_TransMac_2k3des_PK = uFR_int_DesfireWriteRecord_TransMac_2k3des_PK@60 @2175 + uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M = uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M@64 @2176 + uFR_int_DesfireWriteRecord_TransMac_3k3des = uFR_int_DesfireWriteRecord_TransMac_3k3des@60 @2177 + uFR_int_DesfireWriteRecord_TransMac_3k3desM = uFR_int_DesfireWriteRecord_TransMac_3k3desM@64 @2178 + uFR_int_DesfireWriteRecord_TransMac_3k3des_PK = uFR_int_DesfireWriteRecord_TransMac_3k3des_PK@60 @2179 + uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M = uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M@64 @2180 + uFR_int_DesfireWriteRecord_TransMac_aes = uFR_int_DesfireWriteRecord_TransMac_aes@60 @2181 + uFR_int_DesfireWriteRecord_TransMac_aesM = uFR_int_DesfireWriteRecord_TransMac_aesM@64 @2182 + uFR_int_DesfireWriteRecord_TransMac_aes_PK = uFR_int_DesfireWriteRecord_TransMac_aes_PK@60 @2183 + uFR_int_DesfireWriteRecord_TransMac_aes_PK_M = uFR_int_DesfireWriteRecord_TransMac_aes_PK_M@64 @2184 + uFR_int_DesfireWriteRecord_TransMac_des = uFR_int_DesfireWriteRecord_TransMac_des@60 @2185 + uFR_int_DesfireWriteRecord_TransMac_desM = uFR_int_DesfireWriteRecord_TransMac_desM@64 @2186 + uFR_int_DesfireWriteRecord_TransMac_des_PK = uFR_int_DesfireWriteRecord_TransMac_des_PK@60 @2187 + uFR_int_DesfireWriteRecord_TransMac_des_PK_M = uFR_int_DesfireWriteRecord_TransMac_des_PK_M@64 @2188 + uFR_int_DesfireWriteRecord_TransMac_no_auth = uFR_int_DesfireWriteRecord_TransMac_no_auth@56 @2189 + uFR_int_DesfireWriteRecord_TransMac_no_auth_M = uFR_int_DesfireWriteRecord_TransMac_no_auth_M@60 @2190 + uFR_int_DesfireWriteRecord_aes = uFR_int_DesfireWriteRecord_aes@40 @2191 + uFR_int_DesfireWriteRecord_aesM = uFR_int_DesfireWriteRecord_aesM@44 @2192 + uFR_int_DesfireWriteRecord_aes_PK = uFR_int_DesfireWriteRecord_aes_PK@40 @2193 + uFR_int_DesfireWriteRecord_aes_PK_M = uFR_int_DesfireWriteRecord_aes_PK_M@44 @2194 + uFR_int_DesfireWriteRecord_des = uFR_int_DesfireWriteRecord_des@40 @2195 + uFR_int_DesfireWriteRecord_desM = uFR_int_DesfireWriteRecord_desM@44 @2196 + uFR_int_DesfireWriteRecord_des_PK = uFR_int_DesfireWriteRecord_des_PK@40 @2197 + uFR_int_DesfireWriteRecord_des_PK_M = uFR_int_DesfireWriteRecord_des_PK_M@44 @2198 + uFR_int_DesfireWriteRecord_no_auth = uFR_int_DesfireWriteRecord_no_auth@36 @2199 + uFR_int_DesfireWriteRecord_no_authM = uFR_int_DesfireWriteRecord_no_authM@40 @2200 + uFR_int_DesfireWriteStdDataFile = uFR_int_DesfireWriteStdDataFile@40 @2201 + uFR_int_DesfireWriteStdDataFileM = uFR_int_DesfireWriteStdDataFileM@44 @2202 + uFR_int_DesfireWriteStdDataFile_2k3des = uFR_int_DesfireWriteStdDataFile_2k3des@40 @2203 + uFR_int_DesfireWriteStdDataFile_2k3desM = uFR_int_DesfireWriteStdDataFile_2k3desM@44 @2204 + uFR_int_DesfireWriteStdDataFile_2k3des_PK = uFR_int_DesfireWriteStdDataFile_2k3des_PK@40 @2205 + uFR_int_DesfireWriteStdDataFile_2k3des_PK_M = uFR_int_DesfireWriteStdDataFile_2k3des_PK_M@44 @2206 + uFR_int_DesfireWriteStdDataFile_3k3des = uFR_int_DesfireWriteStdDataFile_3k3des@40 @2207 + uFR_int_DesfireWriteStdDataFile_3k3desM = uFR_int_DesfireWriteStdDataFile_3k3desM@44 @2208 + uFR_int_DesfireWriteStdDataFile_3k3des_PK = uFR_int_DesfireWriteStdDataFile_3k3des_PK@40 @2209 + uFR_int_DesfireWriteStdDataFile_3k3des_PK_M = uFR_int_DesfireWriteStdDataFile_3k3des_PK_M@44 @2210 + uFR_int_DesfireWriteStdDataFile_PK = uFR_int_DesfireWriteStdDataFile_PK@40 @2211 + uFR_int_DesfireWriteStdDataFile_PK_M = uFR_int_DesfireWriteStdDataFile_PK_M@44 @2212 + uFR_int_DesfireWriteStdDataFile_aes = uFR_int_DesfireWriteStdDataFile_aes@40 @2213 + uFR_int_DesfireWriteStdDataFile_aesM = uFR_int_DesfireWriteStdDataFile_aesM@44 @2214 + uFR_int_DesfireWriteStdDataFile_aes_PK = uFR_int_DesfireWriteStdDataFile_aes_PK@40 @2215 + uFR_int_DesfireWriteStdDataFile_aes_PK_M = uFR_int_DesfireWriteStdDataFile_aes_PK_M@44 @2216 + uFR_int_DesfireWriteStdDataFile_des = uFR_int_DesfireWriteStdDataFile_des@40 @2217 + uFR_int_DesfireWriteStdDataFile_desM = uFR_int_DesfireWriteStdDataFile_desM@44 @2218 + uFR_int_DesfireWriteStdDataFile_des_PK = uFR_int_DesfireWriteStdDataFile_des_PK@40 @2219 + uFR_int_DesfireWriteStdDataFile_des_PK_M = uFR_int_DesfireWriteStdDataFile_des_PK_M@44 @2220 + uFR_int_DesfireWriteStdDataFile_no_auth = uFR_int_DesfireWriteStdDataFile_no_auth@36 @2221 + uFR_int_DesfireWriteStdDataFile_no_auth_M = uFR_int_DesfireWriteStdDataFile_no_auth_M@40 @2222 + uFR_int_GetDesfireUid = uFR_int_GetDesfireUid@28 @2223 + uFR_int_GetDesfireUidM = uFR_int_GetDesfireUidM@32 @2224 + uFR_int_GetDesfireUid_2k3des = uFR_int_GetDesfireUid_2k3des@28 @2225 + uFR_int_GetDesfireUid_2k3desM = uFR_int_GetDesfireUid_2k3desM@32 @2226 + uFR_int_GetDesfireUid_2k3des_PK = uFR_int_GetDesfireUid_2k3des_PK@28 @2227 + uFR_int_GetDesfireUid_2k3des_PK_M = uFR_int_GetDesfireUid_2k3des_PK_M@32 @2228 + uFR_int_GetDesfireUid_3k3des = uFR_int_GetDesfireUid_3k3des@28 @2229 + uFR_int_GetDesfireUid_3k3desM = uFR_int_GetDesfireUid_3k3desM@32 @2230 + uFR_int_GetDesfireUid_3k3des_PK = uFR_int_GetDesfireUid_3k3des_PK@28 @2231 + uFR_int_GetDesfireUid_3k3des_PK_M = uFR_int_GetDesfireUid_3k3des_PK_M@32 @2232 + uFR_int_GetDesfireUid_PK = uFR_int_GetDesfireUid_PK@28 @2233 + uFR_int_GetDesfireUid_PK_M = uFR_int_GetDesfireUid_PK_M@32 @2234 + uFR_int_GetDesfireUid_aes = uFR_int_GetDesfireUid_aes@28 @2235 + uFR_int_GetDesfireUid_aesM = uFR_int_GetDesfireUid_aesM@32 @2236 + uFR_int_GetDesfireUid_aes_PK = uFR_int_GetDesfireUid_aes_PK@28 @2237 + uFR_int_GetDesfireUid_aes_PK_M = uFR_int_GetDesfireUid_aes_PK_M@32 @2238 + uFR_int_GetDesfireUid_des = uFR_int_GetDesfireUid_des@28 @2239 + uFR_int_GetDesfireUid_desM = uFR_int_GetDesfireUid_desM@32 @2240 + uFR_int_GetDesfireUid_des_PK = uFR_int_GetDesfireUid_des_PK@28 @2241 + uFR_int_GetDesfireUid_des_PK_M = uFR_int_GetDesfireUid_des_PK_M@32 @2242 + uFR_mifare_desfire_aes_key_new_with_version = uFR_mifare_desfire_aes_key_new_with_version@8 @2243 + uFR_mifare_desfire_des_key_new = uFR_mifare_desfire_des_key_new@4 @2244 + uFR_mifare_desfire_key_free = uFR_mifare_desfire_key_free@4 @2245 + uFR_mifare_desfire_tag_free = uFR_mifare_desfire_tag_free@4 @2246 + uFR_mifare_desfire_tag_new = uFR_mifare_desfire_tag_new@0 @2247 + uart_transceive = uart_transceive@20 @2248 + uart_transceiveM = uart_transceiveM@24 @2249 + write_ndef_record = write_ndef_record@36 @2250 + write_ndef_recordM = write_ndef_recordM@40 @2251 + write_ndef_record_mirroring = write_ndef_record_mirroring@48 @2252 + write_ndef_record_mirroringM = write_ndef_record_mirroringM@52 @2253 + write_ndef_record_mirroring_tt = write_ndef_record_mirroring_tt@52 @2254 + write_ndef_record_mirroring_ttM = write_ndef_record_mirroring_ttM@56 @2255 diff --git a/ufr-lib/windows/x86/uFCoder-x86.dll b/ufr-lib/windows/x86/uFCoder-x86.dll new file mode 100644 index 0000000..fe7fc59 Binary files /dev/null and b/ufr-lib/windows/x86/uFCoder-x86.dll differ diff --git a/ufr-lib/windows/x86_64/COMuFCoder-x86_64.dll b/ufr-lib/windows/x86_64/COMuFCoder-x86_64.dll new file mode 100644 index 0000000..40bf359 Binary files /dev/null and b/ufr-lib/windows/x86_64/COMuFCoder-x86_64.dll differ diff --git a/ufr-lib/windows/x86_64/COMuFCoder-x86_64.tlb b/ufr-lib/windows/x86_64/COMuFCoder-x86_64.tlb new file mode 100644 index 0000000..5b26410 Binary files /dev/null and b/ufr-lib/windows/x86_64/COMuFCoder-x86_64.tlb differ diff --git a/ufr-lib/windows/x86_64/libeay32.dll b/ufr-lib/windows/x86_64/libeay32.dll new file mode 100644 index 0000000..950b5c2 Binary files /dev/null and b/ufr-lib/windows/x86_64/libeay32.dll differ diff --git a/ufr-lib/windows/x86_64/uFCoder-x86_64.def b/ufr-lib/windows/x86_64/uFCoder-x86_64.def new file mode 100644 index 0000000..d1cc8d8 --- /dev/null +++ b/ufr-lib/windows/x86_64/uFCoder-x86_64.def @@ -0,0 +1,2256 @@ +EXPORTS + AES_to_DES_key_type @1 + APDUHexStrTransceive @2 + APDUHexStrTransceiveM @3 + APDUPlainTransceive @4 + APDUPlainTransceiveM @5 + APDUPlainTransceiveToHeap @6 + APDUPlainTransceiveToHeapM @7 + APDUTransceive @8 + APDUTransceiveM @9 + APDU_switch_off_from_ISO7816_interface @10 + APDU_switch_off_from_ISO7816_interfaceM @11 + APDU_switch_to_ISO14443_4_interface @12 + APDU_switch_to_ISO14443_4_interfaceM @13 + APDU_switch_to_ISO7816_interface @14 + APDU_switch_to_ISO7816_interfaceM @15 + ATECC608LockConfig @16 + ATECC608LockConfigM @17 + ATECC608LockDataAndOtp @18 + ATECC608LockDataAndOtpM @19 + ATECC608LockKeySlot @20 + ATECC608LockKeySlotM @21 + AdHocEmulationStart @22 + AdHocEmulationStartM @23 + AdHocEmulationStop @24 + AdHocEmulationStopM @25 + AutoSleepGet @26 + AutoSleepGetM @27 + AutoSleepSet @28 + AutoSleepSetM @29 + BalanceGet @30 + BalanceGetM @31 + BalanceSet @32 + BalanceSetM @33 + BlockInSectorRead @34 + BlockInSectorReadM @35 + BlockInSectorReadSamKey @36 + BlockInSectorReadSamkeyM @37 + BlockInSectorRead_AKM1 @38 + BlockInSectorRead_AKM1M @39 + BlockInSectorRead_AKM2 @40 + BlockInSectorRead_AKM2M @41 + BlockInSectorRead_PK @42 + BlockInSectorRead_PKM @43 + BlockInSectorWrite @44 + BlockInSectorWriteM @45 + BlockInSectorWriteSamKey @46 + BlockInSectorWriteSamkeyM @47 + BlockInSectorWrite_AKM1 @48 + BlockInSectorWrite_AKM1M @49 + BlockInSectorWrite_AKM2 @50 + BlockInSectorWrite_AKM2M @51 + BlockInSectorWrite_PK @52 + BlockInSectorWrite_PKM @53 + BlockRead @54 + BlockReadM @55 + BlockReadSamKey @56 + BlockReadSamKeyM @57 + BlockRead_AKM1 @58 + BlockRead_AKM1M @59 + BlockRead_AKM2 @60 + BlockRead_AKM2M @61 + BlockRead_PK @62 + BlockRead_PKM @63 + BlockWrite @64 + BlockWriteM @65 + BlockWriteSamKey @66 + BlockWriteSamKeyM @67 + BlockWrite_AKM1 @68 + BlockWrite_AKM1M @69 + BlockWrite_AKM2 @70 + BlockWrite_AKM2M @71 + BlockWrite_PK @72 + BlockWrite_PKM @73 + BootReader @74 + BusAdminCardMake @75 + COMTransceive @76 + COMTransceiveM @77 + CardEncryption_GetActualCardSN @78 + CardEncryption_GetActualCardSNM @79 + CardEncryption_GetJobSN @80 + CardEncryption_GetJobSNM @81 + CardEncryption_GetNext @82 + CardEncryption_GetNextEncryptedCard @83 + CardEncryption_GetNextEncryptedCardM @84 + CardEncryption_GetNextM @85 + CardEncryption_GetSalterSN @86 + CardEncryption_GetSalterSNM @87 + CardEncryption_Initialize @88 + CardEncryption_InitializeM @89 + ChangeReaderJobId @90 + ChangeReaderJobIdM @91 + ChangeReaderPassword @92 + ChangeReaderPasswordM @93 + CheckUidChangeable @94 + CheckUidChangeableM @95 + CombinedModeEmulationStart @96 + CombinedModeEmulationStartM @97 + DES_to_AES_key_type @98 + DLFree @99 + DLGetEccCurveName @100 + DLGetHash @101 + DLGetHashName @102 + DLGetHashOutputByteLength @103 + DLGetHashToHeap @104 + DLGetSignatureSchemeName @105 + DLHashFinishChunked @106 + DLHashFinishChunkedToHeap @107 + DLHashInitChunked @108 + DLHashUpdateChunked @109 + DL_TLS_Request @110 + DL_TLS_SetClientCertificate @111 + DL_TLS_SetClientX509PrivateKey_PEM @112 + DefaultBaudrateFlashCheck @113 + DefaultBaudrateFlashCheckM @114 + DeslectCard @115 + DeslectCardM @116 + DigitalSignatureVerifyHash @117 + DisableAntiCollision @118 + DisableAntiCollisionM @119 + Display_EraseSection @120 + Display_PrintText @121 + Display_SaveBitmapToGallery @122 + Display_SaveSystemBitmap @123 + Display_ShowBitmap @124 + Display_ShowBitmapFromGallery @125 + Display_ShowLastUnsavedImage @126 + Display_ShowTime @127 + Display_Transmit @128 + Display_UserInterfaceSignal @129 + EE_Lock @130 + EE_Password_Change @131 + EE_Read @132 + EE_Write @133 + EMV_GetLastTransaction @134 + EMV_GetPAN @135 + EnableAntiCollision @136 + EnableAntiCollisionM @137 + EnterShareRamCommMode @138 + EnterShareRamCommModeM @139 + EnumCards @140 + EnumCardsM @141 + EspChangeReaderPassword @142 + EspChangeReaderPasswordM @143 + EspDisableWifi @144 + EspDisableWifiM @145 + EspEnableWifi @146 + EspEnableWifiM @147 + EspGetFirmwareVersion @148 + EspGetFirmwareVersionM @149 + EspGetIOState @150 + EspGetIOStateM @151 + EspGetReaderSerialNumber @152 + EspGetReaderSerialNumberM @153 + EspGetReaderTime @154 + EspGetReaderTimeM @155 + EspGetTransparentReaders @156 + EspReaderEepromRead @157 + EspReaderEepromReadM @158 + EspReaderEepromWrite @159 + EspReaderEepromWriteM @160 + EspReaderReset @161 + EspReaderResetM @162 + EspSetDisplayData @163 + EspSetDisplayDataM @164 + EspSetIOState @165 + EspSetIOStateM @166 + EspSetReaderTime @167 + EspSetReaderTimeM @168 + EspSetTransparentReader @169 + EspSetTransparentReaderM @170 + EspSetTransparentReaderSession @171 + EspTurnOff @172 + EspTurnOffM @173 + ExitShareRamCommMode @174 + ExitShareRamCommModeM @175 + FastFlashCheck @176 + FastFlashCheckM @177 + GetATECC608ConfigZone @178 + GetATECC608ConfigZoneM @179 + GetATECC608InfoRevision @180 + GetATECC608InfoRevisionM @181 + GetATECC608OtpZone @182 + GetATECC608OtpZoneM @183 + GetATECC608ZonesLockStatus @184 + GetATECC608ZonesLockStatusM @185 + GetAdHocEmulationParams @186 + GetAdHocEmulationParamsM @187 + GetAntiCollisionStatus @188 + GetAntiCollisionStatusM @189 + GetAsyncCardIdSendConfig @190 + GetAsyncCardIdSendConfigEx @191 + GetAsyncCardIdSendConfigExM @192 + GetAsyncCardIdSendConfigM @193 + GetAtqaSak @194 + GetAtqaSakM @195 + GetBuildNumber @196 + GetBuildNumberM @197 + GetCardId @198 + GetCardIdEx @199 + GetCardIdExM @200 + GetCardIdM @201 + GetCardManufacturer @202 + GetCardManufacturerM @203 + GetCardSize @204 + GetCardSizeM @205 + GetCustomUiConfig @206 + GetCustomUiConfigM @207 + GetDiscoveryLoopSetup @208 + GetDiscoveryLoopSetupM @209 + GetDisplayIntensity @210 + GetDisplayIntensityM @211 + GetDllVersion @212 + GetDllVersionStr @213 + GetDlogicCardType @214 + GetDlogicCardTypeM @215 + GetExternalFieldState @216 + GetExternalFieldStateM @217 + GetFtdiDriverVersion @218 + GetFtdiDriverVersionM @219 + GetFtdiDriverVersionStr @220 + GetFtdiDriverVersionStrM @221 + GetI2cDevicesStatus @222 + GetI2cDevicesStatusM @223 + GetLastCardIdEx @224 + GetLastCardIdExM @225 + GetLicenseRequestData @226 + GetMobileAdditionalData @227 + GetMobileAdditionalDataM @228 + GetMobileUniqueIdAid @229 + GetMobileUniqueIdAidM @230 + GetNfcT2TVersion @231 + GetNfcT2TVersionM @232 + GetReaderDescription @233 + GetReaderDescriptionM @234 + GetReaderFirmwareVersion @235 + GetReaderFirmwareVersionM @236 + GetReaderHardwareVersion @237 + GetReaderHardwareVersionM @238 + GetReaderLockStatus @239 + GetReaderLockStatusM @240 + GetReaderParameters @241 + GetReaderParametersDefaultBaudrate @242 + GetReaderParametersDefaultBaudrateM @243 + GetReaderParametersM @244 + GetReaderParametersPN7462 @245 + GetReaderParametersPN7462_M @246 + GetReaderProMode @247 + GetReaderProModeM @248 + GetReaderSerialDescription @249 + GetReaderSerialDescriptionM @250 + GetReaderSerialNumber @251 + GetReaderSerialNumberM @252 + GetReaderStatus @253 + GetReaderStatusEx @254 + GetReaderStatusExM @255 + GetReaderStatusM @256 + GetReaderTime @257 + GetReaderTimeM @258 + GetReaderType @259 + GetReaderTypeM @260 + GetRfAnalogRegistersISO14443_212 @261 + GetRfAnalogRegistersISO14443_212M @262 + GetRfAnalogRegistersISO14443_424 @263 + GetRfAnalogRegistersISO14443_424M @264 + GetRfAnalogRegistersTypeA @265 + GetRfAnalogRegistersTypeAM @266 + GetRfAnalogRegistersTypeATrans @267 + GetRfAnalogRegistersTypeATransM @268 + GetRfAnalogRegistersTypeB @269 + GetRfAnalogRegistersTypeBM @270 + GetRfAnalogRegistersTypeBTrans @271 + GetRfAnalogRegistersTypeBTransM @272 + GetRgbIntensity @273 + GetRgbIntensityM @274 + GetServiceData @275 + GetServiceDataM @276 + GetSpeedParameters @277 + GetSpeedParametersM @278 + GreenLedBlinkingTurnOff @279 + GreenLedBlinkingTurnOffM @280 + GreenLedBlinkingTurnOn @281 + GreenLedBlinkingTurnOnM @282 + IncrementCounter @283 + IncrementCounterM @284 + JCAppDeleteEcKeyPair @285 + JCAppDeleteEcKeyPairM @286 + JCAppDeleteRsaKeyPair @287 + JCAppDeleteRsaKeyPairM @288 + JCAppGenerateKeyPair @289 + JCAppGenerateKeyPairM @290 + JCAppGenerateSignature @291 + JCAppGenerateSignatureM @292 + JCAppGetEcKeySizeBits @293 + JCAppGetEcKeySizeBitsM @294 + JCAppGetEcPublicKey @295 + JCAppGetEcPublicKeyM @296 + JCAppGetErrorDescription @297 + JCAppGetObj @298 + JCAppGetObjId @299 + JCAppGetObjIdM @300 + JCAppGetObjM @301 + JCAppGetObjSubject @302 + JCAppGetObjSubjectM @303 + JCAppGetPinTriesRemaining @304 + JCAppGetPinTriesRemainingM @305 + JCAppGetRsaPublicKey @306 + JCAppGetRsaPublicKeyM @307 + JCAppGetSignature @308 + JCAppInvalidateCert @309 + JCAppInvalidateCertM @310 + JCAppLogin @311 + JCAppLoginM @312 + JCAppPinChange @313 + JCAppPinChangeM @314 + JCAppPinDisable @315 + JCAppPinDisableM @316 + JCAppPinEnable @317 + JCAppPinEnableM @318 + JCAppPinUnblock @319 + JCAppPinUnblockM @320 + JCAppPutObj @321 + JCAppPutObjM @322 + JCAppPutObjSubject @323 + JCAppPutObjSubjectM @324 + JCAppPutPrivateKey @325 + JCAppPutPrivateKeyM @326 + JCAppSelectByAid @327 + JCAppSelectByAidM @328 + JCAppSignatureBegin @329 + JCAppSignatureBeginM @330 + JCAppSignatureEnd @331 + JCAppSignatureEndM @332 + JCAppSignatureUpdate @333 + JCAppSignatureUpdateM @334 + JCStorageDeleteFile @335 + JCStorageDeleteFileM @336 + JCStorageGetFileSize @337 + JCStorageGetFileSizeM @338 + JCStorageGetFilesListSize @339 + JCStorageGetFilesListSizeM @340 + JCStorageListFiles @341 + JCStorageListFilesM @342 + JCStorageReadFile @343 + JCStorageReadFileM @344 + JCStorageReadFileToFileSystem @345 + JCStorageReadFileToFileSystemM @346 + JCStorageWriteFile @347 + JCStorageWriteFileFromFileSystem @348 + JCStorageWriteFileFromFileSystemM @349 + JCStorageWriteFileM @350 + LinRowRead @351 + LinRowReadM @352 + LinRowRead_AKM1 @353 + LinRowRead_AKM1M @354 + LinRowRead_AKM2 @355 + LinRowRead_AKM2M @356 + LinRowRead_PK @357 + LinRowRead_PKM @358 + LinearFormatCard @359 + LinearFormatCardM @360 + LinearFormatCard_AKM1 @361 + LinearFormatCard_AKM1M @362 + LinearFormatCard_AKM2 @363 + LinearFormatCard_AKM2M @364 + LinearFormatCard_PK @365 + LinearFormatCard_PKM @366 + LinearRead @367 + LinearReadM @368 + LinearReadSamKey @369 + LinearReadSamKeyM @370 + LinearRead_AKM1 @371 + LinearRead_AKM1M @372 + LinearRead_AKM2 @373 + LinearRead_AKM2M @374 + LinearRead_PK @375 + LinearRead_PKM @376 + LinearWrite @377 + LinearWriteM @378 + LinearWriteSamKey @379 + LinearWriteSamKeyM @380 + LinearWrite_AKM1 @381 + LinearWrite_AKM1M @382 + LinearWrite_AKM2 @383 + LinearWrite_AKM2M @384 + LinearWrite_PK @385 + LinearWrite_PKM @386 + ListCards @387 + ListCardsM @388 + MFP_AesAuthSecurityLevel1 @389 + MFP_AesAuthSecurityLevel1M @390 + MFP_AesAuthSecurityLevel1_PK @391 + MFP_AesAuthSecurityLevel1_PKM @392 + MFP_ChangeConfigurationKey @393 + MFP_ChangeConfigurationKeyM @394 + MFP_ChangeConfigurationKeySamKey @395 + MFP_ChangeConfigurationKeySamKeyM @396 + MFP_ChangeConfigurationKey_PK @397 + MFP_ChangeConfigurationKey_PKM @398 + MFP_ChangeMasterKey @399 + MFP_ChangeMasterKeyM @400 + MFP_ChangeMasterKeySamKey @401 + MFP_ChangeMasterKeySamKeyM @402 + MFP_ChangeMasterKey_PK @403 + MFP_ChangeMasterKey_PKM @404 + MFP_ChangeSectorExtKey @405 + MFP_ChangeSectorExtKeyM @406 + MFP_ChangeSectorKey @407 + MFP_ChangeSectorKeyExt_PK @408 + MFP_ChangeSectorKeyExt_PKM @409 + MFP_ChangeSectorKeyM @410 + MFP_ChangeSectorKeySamExtKey @411 + MFP_ChangeSectorKeySamExtKeyM @412 + MFP_ChangeSectorKeySamKey @413 + MFP_ChangeSectorKeySamKeyM @414 + MFP_ChangeSectorKey_PK @415 + MFP_ChangeSectorKey_PKM @416 + MFP_ChangeVcPollingEncKey @417 + MFP_ChangeVcPollingEncKeyM @418 + MFP_ChangeVcPollingEncKeySamKey @419 + MFP_ChangeVcPollingEncKeySamKeyM @420 + MFP_ChangeVcPollingEncKey_PK @421 + MFP_ChangeVcPollingEncKey_PKM @422 + MFP_ChangeVcPollingMacKey @423 + MFP_ChangeVcPollingMacKeyM @424 + MFP_ChangeVcPollingMacKeySamKey @425 + MFP_ChangeVcPollingMacKeySamKeyM @426 + MFP_ChangeVcPollingMacKey_PK @427 + MFP_ChangeVcPollingMacKey_PKM @428 + MFP_CommitPerso @429 + MFP_CommitPersoM @430 + MFP_FieldConfigurationSet @431 + MFP_FieldConfigurationSetM @432 + MFP_FieldConfigurationSetSamKey @433 + MFP_FieldConfigurationSetSamKeyM @434 + MFP_FieldConfigurationSet_PK @435 + MFP_FieldConfigurationSet_PKM @436 + MFP_GetUid @437 + MFP_GetUidM @438 + MFP_GetUidSamKey @439 + MFP_GetUidSamKeyM @440 + MFP_GetUid_PK @441 + MFP_GetUid_PKM @442 + MFP_PersonalizationMinimal @443 + MFP_PersonalizationMinimalM @444 + MFP_SwitchToSecurityLevel3 @445 + MFP_SwitchToSecurityLevel3M @446 + MFP_SwitchToSecurityLevel3_PK @447 + MFP_SwitchToSecurityLevel3_PKM @448 + MFP_WritePerso @449 + MFP_WritePersoM @450 + MRTDAppSelectAndAuthenticateBac @451 + MRTDAppSelectAndAuthenticateBacM @452 + MRTDFileReadBacToHeap @453 + MRTDFileReadBacToHeapM @454 + MRTDGetDGTagListFromCOM @455 + MRTDGetDgIndex @456 + MRTDGetDgName @457 + MRTDGetImageFromDG2 @458 + MRTDGetImageFromDG2ToFile @459 + MRTDParseDG1ToHeap @460 + MRTDValidate @461 + MRTDValidateM @462 + MRTD_MRZCheck @463 + MRTD_MRZDataToMRZProtoKey @464 + MRTD_MRZSubjacentCheck @465 + MRTD_MRZSubjacentToMRZProtoKey @466 + MRTD_ReadDocumentData @467 + MRTD_SOD_CertToHeap @468 + MRTD_SOD_CertToHeapM @469 + MRTD_SessionClose @470 + MRTD_SessionInit @471 + NfcT2TSafeConvertVersion @472 + Open_ISO7816_Generic @473 + Open_ISO7816_GenericM @474 + OriginalityCheck @475 + PN7462_CodeProtect @476 + PN7462_ESP32_boot_init @477 + PN7462_ExtField @478 + PN7462_LpcdCalibration @479 + PN7462_LpcdPerform @480 + PN7462_RfOff @481 + PN7462_RfOn @482 + PN7462_Test @483 + PN7462_WriteParams @484 + PN7462_WriteParamsUsb @485 + ParamTest1 @486 + ParamTest2 @487 + ParseNdefMessage @488 + ProgReader @489 + ProgReaderStreamUsb @490 + ProgReaderUsb @491 + ReadCounter @492 + ReadCounterM @493 + ReadECCSignature @494 + ReadECCSignatureExt @495 + ReadECCSignatureExtM @496 + ReadECCSignatureM @497 + ReadNFCCounter @498 + ReadNFCCounterM @499 + ReadNFCCounterPwdAuth_PK @500 + ReadNFCCounterPwdAuth_PKM @501 + ReadNFCCounterPwdAuth_RK @502 + ReadNFCCounterPwdAuth_RKM @503 + ReadNdefRecord_Address @504 + ReadNdefRecord_AddressM @505 + ReadNdefRecord_AndroidApp @506 + ReadNdefRecord_AndroidAppM @507 + ReadNdefRecord_BT @508 + ReadNdefRecord_BTM @509 + ReadNdefRecord_Bitcoin @510 + ReadNdefRecord_BitcoinM @511 + ReadNdefRecord_Contact @512 + ReadNdefRecord_ContactM @513 + ReadNdefRecord_Email @514 + ReadNdefRecord_EmailM @515 + ReadNdefRecord_GeoLocation @516 + ReadNdefRecord_GeoLocationM @517 + ReadNdefRecord_NaviDestination @518 + ReadNdefRecord_NaviDestinationM @519 + ReadNdefRecord_Phone @520 + ReadNdefRecord_PhoneM @521 + ReadNdefRecord_SMS @522 + ReadNdefRecord_SMSM @523 + ReadNdefRecord_Skype @524 + ReadNdefRecord_SkypeM @525 + ReadNdefRecord_StreetView @526 + ReadNdefRecord_StreetViewM @527 + ReadNdefRecord_Text @528 + ReadNdefRecord_TextM @529 + ReadNdefRecord_Viber @530 + ReadNdefRecord_ViberM @531 + ReadNdefRecord_Whatsapp @532 + ReadNdefRecord_WhatsappM @533 + ReadNdefRecord_WiFi @534 + ReadNdefRecord_WiFiM @535 + ReadShareRam @536 + ReadShareRamM @537 + ReadTTStatus @538 + ReadTTStatusM @539 + ReadUserData @540 + ReadUserDataExt @541 + ReadUserDataExtM @542 + ReadUserDataM @543 + ReaderClose @544 + ReaderCloseM @545 + ReaderEepromRead @546 + ReaderEepromReadM @547 + ReaderEepromWrite @548 + ReaderEepromWriteM @549 + ReaderHwReset @550 + ReaderKeyWrite @551 + ReaderKeyWriteM @552 + ReaderKeysLock @553 + ReaderKeysLockM @554 + ReaderKeysUnlock @555 + ReaderKeysUnlockM @556 + ReaderList_Add @557 + ReaderList_Destroy @558 + ReaderList_GetFTDIDescriptionByIndex @559 + ReaderList_GetFTDISerialByIndex @560 + ReaderList_GetInformation @561 + ReaderList_GetSerialByIndex @562 + ReaderList_GetSerialDescriptionByIndex @563 + ReaderList_GetTypeByIndex @564 + ReaderList_OpenByIndex @565 + ReaderList_OpenBySerial @566 + ReaderList_UpdateAndGetCount @567 + ReaderOpen @568 + ReaderOpenByType @569 + ReaderOpenEx @570 + ReaderOpenM @571 + ReaderOpen_uFROnline @572 + ReaderReset @573 + ReaderResetM @574 + ReaderResetWait @575 + ReaderRfOff @576 + ReaderRfOffM @577 + ReaderRfOn @578 + ReaderRfOnM @579 + ReaderRfReset @580 + ReaderRfResetM @581 + ReaderSoftRestart @582 + ReaderSoftRestartM @583 + ReaderSoundVolume @584 + ReaderSoundVolumeM @585 + ReaderStillConnected @586 + ReaderStillConnectedM @587 + ReaderUISignal @588 + ReaderUISignalM @589 + RgbControl @590 + RgbControlM @591 + RgbIdleDefault @592 + RgbIdleDefaultM @593 + RgbIdleSet @594 + RgbIdleSetM @595 + RgbInternalTurnOff @596 + RgbInternalTurnOffM @597 + RgbInternalTurnOn @598 + RgbInternalTurnOnM @599 + SAM_authenticate_host_AV2_plain @600 + SAM_authenticate_host_AV2_plainM @601 + SAM_authenticate_host_no_div_des @602 + SAM_authenticate_host_no_div_desM @603 + SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_key @604 + SAM_change_key_entry_2K3DES_ULC_AV2_plain_one_keyM @605 + SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_key @606 + SAM_change_key_entry_2K3DES_desfire_AV2_plain_one_keyM @607 + SAM_change_key_entry_3K3DES_AV2_plain_one_key @608 + SAM_change_key_entry_3K3DES_AV2_plain_one_keyM @609 + SAM_change_key_entry_AES_AV2_plain_one_key @610 + SAM_change_key_entry_AES_AV2_plain_one_keyM @611 + SAM_change_key_entry_DES_AV2_plain_one_key @612 + SAM_change_key_entry_aes_AV2_plain_host_key @613 + SAM_change_key_entry_aes_AV2_plain_host_keyM @614 + SAM_change_key_entry_mifare_AV2_plain_one_key @615 + SAM_change_key_entry_mifare_AV2_plain_one_keyM @616 + SAM_get_key_entry_raw @617 + SAM_get_key_entry_rawM @618 + SAM_get_version @619 + SAM_get_versionM @620 + SAM_get_version_raw @621 + SAM_get_version_rawM @622 + SAM_pre_personalization_switch_to_AV2_mode @623 + SAM_pre_personalization_switch_to_AV2_modeM @624 + SAM_pre_pesonalization_master_AES128_key @625 + SAM_pre_pesonalization_master_AES128_keyM @626 + SectorTrailerWrite @627 + SectorTrailerWriteM @628 + SectorTrailerWriteSamKey @629 + SectorTrailerWriteSamKeyM @630 + SectorTrailerWriteUnsafe @631 + SectorTrailerWriteUnsafeM @632 + SectorTrailerWriteUnsafe_AKM1 @633 + SectorTrailerWriteUnsafe_AKM1M @634 + SectorTrailerWriteUnsafe_AKM2 @635 + SectorTrailerWriteUnsafe_AKM2M @636 + SectorTrailerWriteUnsafe_PK @637 + SectorTrailerWriteUnsafe_PKM @638 + SectorTrailerWrite_AKM1 @639 + SectorTrailerWrite_AKM1M @640 + SectorTrailerWrite_AKM2 @641 + SectorTrailerWrite_AKM2M @642 + SectorTrailerWrite_PK @643 + SectorTrailerWrite_PKM @644 + SelectCard @645 + SelectCardM @646 + SetATECC608DefaultKeysConfiguration @647 + SetATECC608DefaultKeysConfigurationM @648 + SetATECC608DefaultSlotsConfiguration @649 + SetATECC608DefaultSlotsConfigurationM @650 + SetATECC608ECCPrivateKey @651 + SetATECC608ECCPrivateKeyM @652 + SetATECC608ECCPrivateKeyUnencrypted @653 + SetATECC608ECCPrivateKeyUnencryptedM @654 + SetATECC608IOSecretKey @655 + SetATECC608IOSecretKeyM @656 + SetAdHocEmulationParams @657 + SetAdHocEmulationParamsM @658 + SetAsyncCardIdSendConfig @659 + SetAsyncCardIdSendConfigEx @660 + SetAsyncCardIdSendConfigExM @661 + SetAsyncCardIdSendConfigM @662 + SetCustomUiConfig @663 + SetCustomUiConfigM @664 + SetDefaultUartSpeed @665 + SetDiscoveryLoop @666 + SetDiscoveryLoopM @667 + SetDisplayData @668 + SetDisplayDataM @669 + SetDisplayIntensity @670 + SetDisplayIntensityM @671 + SetISO14443_4_DLStorage @672 + SetISO14443_4_DLStorageM @673 + SetISO14443_4_Mode @674 + SetISO14443_4_ModeM @675 + SetISO14443_4_Mode_GetATS @676 + SetISO14443_4_Mode_GetATSM @677 + SetLicenseData @678 + SetMobileUniqueIdAid @679 + SetMobileUniqueIdAidM @680 + SetReaderProMode @681 + SetReaderProModeM @682 + SetReaderSerialDescription @683 + SetReaderSerialDescriptionM @684 + SetReaderTime @685 + SetReaderTimeM @686 + SetRfAnalogRegistersISO14443_212 @687 + SetRfAnalogRegistersISO14443_212Default @688 + SetRfAnalogRegistersISO14443_212DefaultM @689 + SetRfAnalogRegistersISO14443_212M @690 + SetRfAnalogRegistersISO14443_424 @691 + SetRfAnalogRegistersISO14443_424Default @692 + SetRfAnalogRegistersISO14443_424DefaultM @693 + SetRfAnalogRegistersISO14443_424M @694 + SetRfAnalogRegistersTypeA @695 + SetRfAnalogRegistersTypeADefault @696 + SetRfAnalogRegistersTypeADefaultM @697 + SetRfAnalogRegistersTypeAM @698 + SetRfAnalogRegistersTypeATrans @699 + SetRfAnalogRegistersTypeATransM @700 + SetRfAnalogRegistersTypeB @701 + SetRfAnalogRegistersTypeBDefault @702 + SetRfAnalogRegistersTypeBDefaultM @703 + SetRfAnalogRegistersTypeBM @704 + SetRfAnalogRegistersTypeBTrans @705 + SetRfAnalogRegistersTypeBTransM @706 + SetRgbData @707 + SetRgbDataM @708 + SetRgbIntensity @709 + SetRgbIntensityM @710 + SetServiceData @711 + SetServiceDataM @712 + SetSpeakerFrequency @713 + SetSpeakerFrequencyM @714 + SetSpeedPermanently @715 + SetSpeedPermanentlyM @716 + SetUartSpeed @717 + StartAsyncSession @718 + StopAsyncSession @719 + SubscribeBlock @720 + SubscribeSector @721 + TagEmulationMirrorCounterDisabled @722 + TagEmulationMirrorCounterNonResetEnabled @723 + TagEmulationMirrorCounterResetEnabled @724 + TagEmulationStart @725 + TagEmulationStartM @726 + TagEmulationStartRam @727 + TagEmulationStop @728 + TagEmulationStopM @729 + TagEmulationStopRam @730 + UFR_DLCardType2String @731 + UFR_SessionStatus2String @732 + UFR_Status2String @733 + ULC_ExternalAuth_PK @734 + ULC_ExternalAuth_PKM @735 + ULC_write_3des_key @736 + ULC_write_3des_keyM @737 + ULC_write_3des_key_factory_key @738 + ULC_write_3des_key_factory_keyM @739 + ULC_write_3des_key_factory_key_internal @740 + ULC_write_3des_key_factory_key_internalM @741 + ULC_write_3des_key_internal @742 + ULC_write_3des_key_internalM @743 + ULC_write_3des_key_no_auth @744 + ULC_write_3des_key_no_authM @745 + ULC_write_3des_key_no_auth_internal @746 + ULC_write_3des_key_no_auth_internalM @747 + UfrEnterSleepMode @748 + UfrEnterSleepModeM @749 + UfrGetBadSelectCardNrMax @750 + UfrGetBadSelectCardNrMaxM @751 + UfrGetInputState @752 + UfrLeaveSleepMode @753 + UfrLeaveSleepModeM @754 + UfrOutControl @755 + UfrOutControlM @756 + UfrRedLightControl @757 + UfrRedLightControlM @758 + UfrRgbExtLightControl @759 + UfrRgbExtLightControlM @760 + UfrRgbLightControl @761 + UfrRgbLightControlM @762 + UfrRgbLightControlRfPeriod @763 + UfrRgbLightControlRfPeriodM @764 + UfrRgbLightControlSleep @765 + UfrRgbLightControlSleepM @766 + UfrSetBadSelectCardNrMax @767 + UfrSetBadSelectCardNrMaxM @768 + UfrXrcGetIoState @769 + UfrXrcGetIoStateM @770 + UfrXrcLockOn @771 + UfrXrcLockOnM @772 + UfrXrcRelayState @773 + UfrXrcRelayStateM @774 + ValueBlockDecrement @775 + ValueBlockDecrementM @776 + ValueBlockDecrementSamKey @777 + ValueBlockDecrementSamKeyM @778 + ValueBlockDecrement_AKM1 @779 + ValueBlockDecrement_AKM1M @780 + ValueBlockDecrement_AKM2 @781 + ValueBlockDecrement_AKM2M @782 + ValueBlockDecrement_PK @783 + ValueBlockDecrement_PKM @784 + ValueBlockInSectorDecrement @785 + ValueBlockInSectorDecrementM @786 + ValueBlockInSectorDecrementSamKey @787 + ValueBlockInSectorDecrementSamKeyM @788 + ValueBlockInSectorDecrement_AKM1 @789 + ValueBlockInSectorDecrement_AKM1M @790 + ValueBlockInSectorDecrement_AKM2 @791 + ValueBlockInSectorDecrement_AKM2M @792 + ValueBlockInSectorDecrement_PK @793 + ValueBlockInSectorDecrement_PKM @794 + ValueBlockInSectorIncrement @795 + ValueBlockInSectorIncrementM @796 + ValueBlockInSectorIncrementSamKey @797 + ValueBlockInSectorIncrementSamKeyM @798 + ValueBlockInSectorIncrement_AKM1 @799 + ValueBlockInSectorIncrement_AKM1M @800 + ValueBlockInSectorIncrement_AKM2 @801 + ValueBlockInSectorIncrement_AKM2M @802 + ValueBlockInSectorIncrement_PK @803 + ValueBlockInSectorIncrement_PKM @804 + ValueBlockInSectorRead @805 + ValueBlockInSectorReadM @806 + ValueBlockInSectorReadSamKey @807 + ValueBlockInSectorReadSamKeyM @808 + ValueBlockInSectorRead_AKM1 @809 + ValueBlockInSectorRead_AKM1M @810 + ValueBlockInSectorRead_AKM2 @811 + ValueBlockInSectorRead_AKM2M @812 + ValueBlockInSectorRead_PK @813 + ValueBlockInSectorRead_PKM @814 + ValueBlockInSectorWrite @815 + ValueBlockInSectorWriteM @816 + ValueBlockInSectorWriteSamKey @817 + ValueBlockInSectorWriteSamKeyM @818 + ValueBlockInSectorWrite_AKM1 @819 + ValueBlockInSectorWrite_AKM1M @820 + ValueBlockInSectorWrite_AKM2 @821 + ValueBlockInSectorWrite_AKM2M @822 + ValueBlockInSectorWrite_PK @823 + ValueBlockInSectorWrite_PKM @824 + ValueBlockIncrement @825 + ValueBlockIncrementM @826 + ValueBlockIncrementSamKey @827 + ValueBlockIncrementSamKeyM @828 + ValueBlockIncrement_AKM1 @829 + ValueBlockIncrement_AKM1M @830 + ValueBlockIncrement_AKM2 @831 + ValueBlockIncrement_AKM2M @832 + ValueBlockIncrement_PK @833 + ValueBlockIncrement_PKM @834 + ValueBlockRead @835 + ValueBlockReadM @836 + ValueBlockReadSamKey @837 + ValueBlockReadSamKeyM @838 + ValueBlockRead_AKM1 @839 + ValueBlockRead_AKM1M @840 + ValueBlockRead_AKM2 @841 + ValueBlockRead_AKM2M @842 + ValueBlockRead_PK @843 + ValueBlockRead_PKM @844 + ValueBlockWrite @845 + ValueBlockWriteM @846 + ValueBlockWriteSamKey @847 + ValueBlockWriteSamKeyM @848 + ValueBlockWrite_AKM1 @849 + ValueBlockWrite_AKM1M @850 + ValueBlockWrite_AKM2 @851 + ValueBlockWrite_AKM2M @852 + ValueBlockWrite_PK @853 + ValueBlockWrite_PKM @854 + WriteEmulationNdef @855 + WriteEmulationNdefM @856 + WriteEmulationNdefRam @857 + WriteEmulationNdefRamM @858 + WriteEmulationNdefWithAAR @859 + WriteNdefRecord_Address @860 + WriteNdefRecord_AddressM @861 + WriteNdefRecord_AndroidApp @862 + WriteNdefRecord_AndroidAppM @863 + WriteNdefRecord_BT @864 + WriteNdefRecord_BTM @865 + WriteNdefRecord_Bitcoin @866 + WriteNdefRecord_BitcoinM @867 + WriteNdefRecord_Contact @868 + WriteNdefRecord_ContactM @869 + WriteNdefRecord_Email @870 + WriteNdefRecord_EmailM @871 + WriteNdefRecord_GeoLocation @872 + WriteNdefRecord_GeoLocationM @873 + WriteNdefRecord_NaviDestination @874 + WriteNdefRecord_NaviDestinationM @875 + WriteNdefRecord_Phone @876 + WriteNdefRecord_PhoneM @877 + WriteNdefRecord_SMS @878 + WriteNdefRecord_SMSM @879 + WriteNdefRecord_Skype @880 + WriteNdefRecord_SkypeM @881 + WriteNdefRecord_StreetView @882 + WriteNdefRecord_StreetViewM @883 + WriteNdefRecord_Text @884 + WriteNdefRecord_TextM @885 + WriteNdefRecord_Viber @886 + WriteNdefRecord_ViberM @887 + WriteNdefRecord_Whatsapp @888 + WriteNdefRecord_WhatsappM @889 + WriteNdefRecord_WiFi @890 + WriteNdefRecord_WiFiM @891 + WriteReaderId @892 + WriteReaderIdM @893 + WriteSamUnlockKey @894 + WriteSamUnlockKeyM @895 + WriteShareRam @896 + WriteShareRamM @897 + WriteUserData @898 + WriteUserDataExt @899 + WriteUserDataExtM @900 + WriteUserDataM @901 + ais_erase_right_record @902 + ais_erase_right_recordM @903 + ais_get_card_daily_duration @904 + ais_get_card_daily_durationM @905 + ais_get_card_number @906 + ais_get_card_numberM @907 + ais_get_card_total_duration @908 + ais_get_card_total_durationM @909 + ais_get_card_type @910 + ais_get_card_typeM @911 + ais_get_credit_and_period_validity @912 + ais_get_credit_and_period_validityM @913 + ais_get_right_record @914 + ais_get_right_recordM @915 + ais_get_right_record_type_max_daily_counter @916 + ais_get_right_record_type_max_daily_counterM @917 + ais_get_right_type_record @918 + ais_get_right_type_recordM @919 + ais_get_validate_record @920 + ais_get_validate_recordM @921 + ais_set_card_daily_duration @922 + ais_set_card_daily_durationM @923 + ais_set_card_total_duration @924 + ais_set_card_total_durationM @925 + ais_set_card_type @926 + ais_set_card_typeM @927 + ais_set_credit_and_period_validity @928 + ais_set_credit_and_period_validityM @929 + ais_set_right_record @930 + ais_set_right_recordM @931 + ais_set_right_record_type_max_daily_counter @932 + ais_set_right_record_type_max_daily_counterM @933 + ais_set_right_type_record @934 + ais_set_right_type_recordM @935 + ais_set_validate_record @936 + ais_set_validate_recordM @937 + card_halt_enable @938 + card_halt_enableM @939 + card_transceive @940 + card_transceiveM @941 + card_transceive_mode_start @942 + card_transceive_mode_startM @943 + card_transceive_mode_stop @944 + card_transceive_mode_stopM @945 + close_ISO7816_interface_APDU_ISO14443_4 @946 + close_ISO7816_interface_APDU_ISO14443_4M @947 + close_ISO7816_interface_no_APDU @948 + close_ISO7816_interface_no_APDUM @949 + desfire_check_clear_record_transaction_mac @950 + desfire_check_write_record_transaction_mac @951 + dfl_change_file_settings @952 + dfl_change_file_settingsM @953 + dfl_change_file_settings_pk @954 + dfl_change_file_settings_pkM @955 + dfl_change_tmc_file_settings @956 + dfl_change_tmc_file_settingsM @957 + dfl_change_tmc_file_settings_pk @958 + dfl_change_tmc_file_settings_pkM @959 + dfl_check_credit_value_transaction_mac @960 + dfl_check_debit_value_transaction_mac @961 + dfl_check_write_record_transaction_mac @962 + dfl_delete_tmc_file @963 + dfl_delete_tmc_fileM @964 + dfl_delete_tmc_file_pk @965 + dfl_delete_tmc_file_pkM @966 + dfl_get_file_settings @967 + erase_all_ndef_records @968 + erase_all_ndef_recordsM @969 + erase_last_ndef_record @970 + erase_last_ndef_recordM @971 + get_ndef_record_count @972 + get_ndef_record_countM @973 + i_block_trans_rcv_chain @974 + i_block_trans_rcv_chainM @975 + icode_lock_block @976 + icode_lock_blockM @977 + icode_lock_block_PK @978 + icode_lock_block_PK_M @979 + icode_protect_page @980 + icode_protect_pageM @981 + icode_protect_page_PK @982 + icode_protect_page_PK_M @983 + icode_write_password @984 + icode_write_passwordM @985 + icode_write_password_PK @986 + icode_write_password_PK_M @987 + iso15693_get_multiply_block_security_status @988 + iso15693_get_multiply_block_security_statusM @989 + iso15693_lock_block_no_auth @990 + iso15693_lock_block_no_authM @991 + ndef_card_initialization @992 + ndef_card_initializationM @993 + nt4h_change_key @994 + nt4h_change_keyM @995 + nt4h_change_key_pk @996 + nt4h_change_key_pkM @997 + nt4h_change_sdm_file_settings @998 + nt4h_change_sdm_file_settingsM @999 + nt4h_change_sdm_file_settings_pk @1000 + nt4h_change_sdm_file_settings_pkM @1001 + nt4h_change_standard_file_settings @1002 + nt4h_change_standard_file_settingsM @1003 + nt4h_change_standard_file_settings_pk @1004 + nt4h_change_standard_file_settings_pkM @1005 + nt4h_check_sdm_mac @1006 + nt4h_decrypt_picc_data @1007 + nt4h_decrypt_sdm_enc_file_data @1008 + nt4h_enable_tt @1009 + nt4h_enable_ttM @1010 + nt4h_enable_tt_pk @1011 + nt4h_enable_tt_pkM @1012 + nt4h_get_file_settings @1013 + nt4h_get_file_settingsM @1014 + nt4h_get_sdm_ctr @1015 + nt4h_get_sdm_ctrM @1016 + nt4h_get_sdm_ctr_no_auth @1017 + nt4h_get_sdm_ctr_no_authM @1018 + nt4h_get_sdm_ctr_pk @1019 + nt4h_get_sdm_ctr_pkM @1020 + nt4h_get_tt_status @1021 + nt4h_get_tt_statusM @1022 + nt4h_get_tt_status_no_auth @1023 + nt4h_get_tt_status_no_authM @1024 + nt4h_get_tt_status_pk @1025 + nt4h_get_tt_status_pkM @1026 + nt4h_get_uid @1027 + nt4h_get_uidM @1028 + nt4h_get_uid_pk @1029 + nt4h_get_uid_pkM @1030 + nt4h_rid_read_ecc_signature @1031 + nt4h_rid_read_ecc_signatureM @1032 + nt4h_rid_read_ecc_signature_pk @1033 + nt4h_rid_read_ecc_signature_pkM @1034 + nt4h_set_global_parameters @1035 + nt4h_set_global_parametersM @1036 + nt4h_set_rid @1037 + nt4h_set_ridM @1038 + nt4h_set_rid_pk @1039 + nt4h_set_rid_pkM @1040 + nt4h_tt_change_sdm_file_settings @1041 + nt4h_tt_change_sdm_file_settingsM @1042 + nt4h_tt_change_sdm_file_settings_pk @1043 + nt4h_tt_change_sdm_file_settings_pkM @1044 + nt4h_tt_get_file_settings @1045 + nt4h_tt_get_file_settingsM @1046 + nt4h_unset_rid_pk @1047 + open_ISO7816_interface @1048 + open_ISO7816_interfaceM @1049 + r_block_transceive @1050 + r_block_transceiveM @1051 + read_ndef_record @1052 + read_ndef_recordM @1053 + s_block_deselect @1054 + s_block_deselectM @1055 + setCardDetectedCallback @1056 + setCardRemovedCallback @1057 + setSessionErrorCallback @1058 + test_desfire_ver @1059 + test_i_block @1060 + uFR_APDU_Start @1061 + uFR_APDU_StartM @1062 + uFR_APDU_Stop @1063 + uFR_APDU_StopM @1064 + uFR_APDU_Transceive @1065 + uFR_APDU_TransceiveM @1066 + uFR_DESFIRE_Start @1067 + uFR_DESFIRE_StartM @1068 + uFR_DESFIRE_Stop @1069 + uFR_DESFIRE_StopM @1070 + uFR_SAM_DesfireChange2k3desKey_2k3desAuth @1071 + uFR_SAM_DesfireChange2k3desKey_2k3desAuthM @1072 + uFR_SAM_DesfireChange2k3desKey_DesAuth @1073 + uFR_SAM_DesfireChange2k3desKey_DesAuthM @1074 + uFR_SAM_DesfireChange3k3desKey_3k3desAuth @1075 + uFR_SAM_DesfireChange3k3desKey_3k3desAuthM @1076 + uFR_SAM_DesfireChangeAesKey_AesAuth @1077 + uFR_SAM_DesfireChangeDesKey_2k3desAuth @1078 + uFR_SAM_DesfireChangeDesKey_2k3desAuthM @1079 + uFR_SAM_DesfireChangeDesKey_DesAuth @1080 + uFR_SAM_DesfireChangeDesKey_DesAuthM @1081 + uFR_SAM_DesfireChangeFileSettings2k3desAuth @1082 + uFR_SAM_DesfireChangeFileSettings2k3desAuthM @1083 + uFR_SAM_DesfireChangeFileSettings3k3desAuth @1084 + uFR_SAM_DesfireChangeFileSettings3k3desAuthM @1085 + uFR_SAM_DesfireChangeFileSettingsAesAuth @1086 + uFR_SAM_DesfireChangeFileSettingsAesAuthM @1087 + uFR_SAM_DesfireChangeFileSettingsDesAuth @1088 + uFR_SAM_DesfireChangeFileSettingsDesAuthM @1089 + uFR_SAM_DesfireChangeFileSettingsSdm @1090 + uFR_SAM_DesfireChangeFileSettingsSdmM @1091 + uFR_SAM_DesfireChangeKeySettings2k3desAuth @1092 + uFR_SAM_DesfireChangeKeySettings2k3desAuthM @1093 + uFR_SAM_DesfireChangeKeySettings3k3desAuth @1094 + uFR_SAM_DesfireChangeKeySettings3k3desAuthM @1095 + uFR_SAM_DesfireChangeKeySettingsAesAuth @1096 + uFR_SAM_DesfireChangeKeySettingsAesAuthM @1097 + uFR_SAM_DesfireChangeKeySettingsDesAuth @1098 + uFR_SAM_DesfireChangeKeySettingsDesAuthM @1099 + uFR_SAM_DesfireChangeKey_AesAuthM @1100 + uFR_SAM_DesfireChangeMasterKey @1101 + uFR_SAM_DesfireChangeMasterKeyM @1102 + uFR_SAM_DesfireClearRecordFile2k3desAuth @1103 + uFR_SAM_DesfireClearRecordFile2k3desAuth_2 @1104 + uFR_SAM_DesfireClearRecordFile2k3desAuth_2M @1105 + uFR_SAM_DesfireClearRecordFile3k3desAuth @1106 + uFR_SAM_DesfireClearRecordFile3k3desAuthM @1107 + uFR_SAM_DesfireClearRecordFile3k3desAuth_2 @1108 + uFR_SAM_DesfireClearRecordFile3k3desAuth_2M @1109 + uFR_SAM_DesfireClearRecordFileAesAuth @1110 + uFR_SAM_DesfireClearRecordFileAesAuthM @1111 + uFR_SAM_DesfireClearRecordFileAesAuth_2 @1112 + uFR_SAM_DesfireClearRecordFileAesAuth_2M @1113 + uFR_SAM_DesfireClearRecordFileDesAuth @1114 + uFR_SAM_DesfireClearRecordFileDesAuth_2 @1115 + uFR_SAM_DesfireClearRecordFileDesAuth_2M @1116 + uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuth @1117 + uFR_SAM_DesfireClearRecordFile_TransMac_2k3desAuthM @1118 + uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuth @1119 + uFR_SAM_DesfireClearRecordFile_TransMac_3k3desAuthM @1120 + uFR_SAM_DesfireClearRecordFile_TransMac_AesAuth @1121 + uFR_SAM_DesfireClearRecordFile_TransMac_AesAuthM @1122 + uFR_SAM_DesfireClearRecordFile_TransMac_DesAuth @1123 + uFR_SAM_DesfireClearRecordFile_TransMac_DesAuthM @1124 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuth @1125 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIso @1126 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthIsoM @1127 + uFR_SAM_DesfireCreate3k3desApplication2k3desAuthM @1128 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuth @1129 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIso @1130 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthIsoM @1131 + uFR_SAM_DesfireCreate3k3desApplication3k3desAuthM @1132 + uFR_SAM_DesfireCreate3k3desApplicationAesAuth @1133 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthIso @1134 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthIsoM @1135 + uFR_SAM_DesfireCreate3k3desApplicationAesAuthM @1136 + uFR_SAM_DesfireCreate3k3desApplicationDesAuth @1137 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthIso @1138 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthIsoM @1139 + uFR_SAM_DesfireCreate3k3desApplicationDesAuthM @1140 + uFR_SAM_DesfireCreateAesApplication2k3desAuth @1141 + uFR_SAM_DesfireCreateAesApplication2k3desAuthIso @1142 + uFR_SAM_DesfireCreateAesApplication2k3desAuthIsoM @1143 + uFR_SAM_DesfireCreateAesApplication2k3desAuthM @1144 + uFR_SAM_DesfireCreateAesApplication3k3desAuth @1145 + uFR_SAM_DesfireCreateAesApplication3k3desAuthIso @1146 + uFR_SAM_DesfireCreateAesApplication3k3desAuthIsoM @1147 + uFR_SAM_DesfireCreateAesApplication3k3desAuthM @1148 + uFR_SAM_DesfireCreateAesApplicationAesAuth @1149 + uFR_SAM_DesfireCreateAesApplicationAesAuthIso @1150 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscd @1151 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoAscdM @1152 + uFR_SAM_DesfireCreateAesApplicationAesAuthIsoM @1153 + uFR_SAM_DesfireCreateAesApplicationAesAuthM @1154 + uFR_SAM_DesfireCreateAesApplicationDesAuth @1155 + uFR_SAM_DesfireCreateAesApplicationDesAuthIso @1156 + uFR_SAM_DesfireCreateAesApplicationDesAuthIsoM @1157 + uFR_SAM_DesfireCreateAesApplicationDesAuthM @1158 + uFR_SAM_DesfireCreateBackupDataFile2k3desAuth @1159 + uFR_SAM_DesfireCreateBackupDataFile2k3desAuthM @1160 + uFR_SAM_DesfireCreateBackupDataFile3k3desAuth @1161 + uFR_SAM_DesfireCreateBackupDataFile3k3desAuthM @1162 + uFR_SAM_DesfireCreateBackupDataFileAesAuth @1163 + uFR_SAM_DesfireCreateBackupDataFileAesAuthM @1164 + uFR_SAM_DesfireCreateBackupDataFileDesAuth @1165 + uFR_SAM_DesfireCreateBackupdDataFileDesAuthM @1166 + uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuth @1167 + uFR_SAM_DesfireCreateCyclicRecordFile2k3desAuthM @1168 + uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuth @1169 + uFR_SAM_DesfireCreateCyclicRecordFile3k3desAuthM @1170 + uFR_SAM_DesfireCreateCyclicRecordFileAesAuth @1171 + uFR_SAM_DesfireCreateCyclicRecordFileAesAuthM @1172 + uFR_SAM_DesfireCreateCyclicRecordFileDesAuth @1173 + uFR_SAM_DesfireCreateCyclicRecordFileDesAuthM @1174 + uFR_SAM_DesfireCreateDesApplication2k3desAuth @1175 + uFR_SAM_DesfireCreateDesApplication2k3desAuthIso @1176 + uFR_SAM_DesfireCreateDesApplication2k3desAuthIsoM @1177 + uFR_SAM_DesfireCreateDesApplication2k3desAuthM @1178 + uFR_SAM_DesfireCreateDesApplication3k3desAuth @1179 + uFR_SAM_DesfireCreateDesApplication3k3desAuthIso @1180 + uFR_SAM_DesfireCreateDesApplication3k3desAuthIsoM @1181 + uFR_SAM_DesfireCreateDesApplication3k3desAuthM @1182 + uFR_SAM_DesfireCreateDesApplicationAesAuth @1183 + uFR_SAM_DesfireCreateDesApplicationAesAuthIso @1184 + uFR_SAM_DesfireCreateDesApplicationAesAuthIsoM @1185 + uFR_SAM_DesfireCreateDesApplicationAesAuthM @1186 + uFR_SAM_DesfireCreateDesApplicationDesAuth @1187 + uFR_SAM_DesfireCreateDesApplicationDesAuthIso @1188 + uFR_SAM_DesfireCreateDesApplicationDesAuthIsoM @1189 + uFR_SAM_DesfireCreateDesApplicationDesAuthM @1190 + uFR_SAM_DesfireCreateLinearRecordFile2k3desAuth @1191 + uFR_SAM_DesfireCreateLinearRecordFile2k3desAuthM @1192 + uFR_SAM_DesfireCreateLinearRecordFile3k3desAuth @1193 + uFR_SAM_DesfireCreateLinearRecordFile3k3desAuthM @1194 + uFR_SAM_DesfireCreateLinearRecordFileAesAuth @1195 + uFR_SAM_DesfireCreateLinearRecordFileAesAuthM @1196 + uFR_SAM_DesfireCreateLinearRecordFileDesAuth @1197 + uFR_SAM_DesfireCreateLinearRecordFileDesAuthM @1198 + uFR_SAM_DesfireCreateStdDataFile2k3desAuth @1199 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthIso @1200 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthIsoM @1201 + uFR_SAM_DesfireCreateStdDataFile2k3desAuthM @1202 + uFR_SAM_DesfireCreateStdDataFile3k3desAuth @1203 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthIso @1204 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthIsoM @1205 + uFR_SAM_DesfireCreateStdDataFile3k3desAuthM @1206 + uFR_SAM_DesfireCreateStdDataFileAesAuth @1207 + uFR_SAM_DesfireCreateStdDataFileAesAuthIso @1208 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoM @1209 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdm @1210 + uFR_SAM_DesfireCreateStdDataFileAesAuthIsoSdmM @1211 + uFR_SAM_DesfireCreateStdDataFileAesAuthM @1212 + uFR_SAM_DesfireCreateStdDataFileDesAuth @1213 + uFR_SAM_DesfireCreateStdDataFileDesAuthIso @1214 + uFR_SAM_DesfireCreateStdDataFileDesAuthIsoM @1215 + uFR_SAM_DesfireCreateStdDataFileDesAuthM @1216 + uFR_SAM_DesfireCreateTransMacFile2k3desAuth @1217 + uFR_SAM_DesfireCreateTransMacFile2k3desAuthM @1218 + uFR_SAM_DesfireCreateTransMacFile3k3desAuth @1219 + uFR_SAM_DesfireCreateTransMacFile3k3desAuthM @1220 + uFR_SAM_DesfireCreateTransMacFileAesAuth @1221 + uFR_SAM_DesfireCreateTransMacFileAesAuthM @1222 + uFR_SAM_DesfireCreateTransMacFileDesAuth @1223 + uFR_SAM_DesfireCreateTransMacFileDesAuthM @1224 + uFR_SAM_DesfireCreateValueFile2k3desAuth @1225 + uFR_SAM_DesfireCreateValueFile2k3desAuthM @1226 + uFR_SAM_DesfireCreateValueFile3k3desAuth @1227 + uFR_SAM_DesfireCreateValueFile3k3desAuthM @1228 + uFR_SAM_DesfireCreateValueFileAesAuth @1229 + uFR_SAM_DesfireCreateValueFileAesAuthM @1230 + uFR_SAM_DesfireCreateValueFileDesAuth @1231 + uFR_SAM_DesfireCreateValueFileDesAuthM @1232 + uFR_SAM_DesfireDecreaseValueFile2k3desAuth @1233 + uFR_SAM_DesfireDecreaseValueFile2k3desAuthM @1234 + uFR_SAM_DesfireDecreaseValueFile3k3desAuth @1235 + uFR_SAM_DesfireDecreaseValueFile3k3desAuthM @1236 + uFR_SAM_DesfireDecreaseValueFileAesAuth @1237 + uFR_SAM_DesfireDecreaseValueFileAesAuthM @1238 + uFR_SAM_DesfireDecreaseValueFileDesAuth @1239 + uFR_SAM_DesfireDecreaseValueFileDesAuthM @1240 + uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuth @1241 + uFR_SAM_DesfireDecreaseValueFile_TransMac_2k3desAuthM @1242 + uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuth @1243 + uFR_SAM_DesfireDecreaseValueFile_TransMac_3k3desAuthM @1244 + uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuth @1245 + uFR_SAM_DesfireDecreaseValueFile_TransMac_AesAuthM @1246 + uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuth @1247 + uFR_SAM_DesfireDecreaseValueFile_TransMac_DesAuthM @1248 + uFR_SAM_DesfireDeleteApplication2k3desAuth @1249 + uFR_SAM_DesfireDeleteApplication2k3desAuthM @1250 + uFR_SAM_DesfireDeleteApplication3k3desAuth @1251 + uFR_SAM_DesfireDeleteApplication3k3desAuthM @1252 + uFR_SAM_DesfireDeleteApplicationAesAuth @1253 + uFR_SAM_DesfireDeleteApplicationAesAuthM @1254 + uFR_SAM_DesfireDeleteApplicationDesAuth @1255 + uFR_SAM_DesfireDeleteApplicationDesAuthM @1256 + uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuth @1257 + uFR_SAM_DesfireDeleteApplication_app_master_2k3desAuthM @1258 + uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuth @1259 + uFR_SAM_DesfireDeleteApplication_app_master_3k3desAuthM @1260 + uFR_SAM_DesfireDeleteApplication_app_master_AesAuth @1261 + uFR_SAM_DesfireDeleteApplication_app_master_AesAuthM @1262 + uFR_SAM_DesfireDeleteApplication_app_master_DesAuth @1263 + uFR_SAM_DesfireDeleteApplication_app_master_DesAuthM @1264 + uFR_SAM_DesfireDeleteFile2k3desAuth @1265 + uFR_SAM_DesfireDeleteFile2k3desAuthM @1266 + uFR_SAM_DesfireDeleteFile3k3desAuth @1267 + uFR_SAM_DesfireDeleteFile3k3desAuthM @1268 + uFR_SAM_DesfireDeleteFileAesAuth @1269 + uFR_SAM_DesfireDeleteFileAesAuthM @1270 + uFR_SAM_DesfireDeleteFileDesAuth @1271 + uFR_SAM_DesfireDeleteFileDesAuthM @1272 + uFR_SAM_DesfireFormatCard2k3desAuth @1273 + uFR_SAM_DesfireFormatCard2k3desAuthM @1274 + uFR_SAM_DesfireFormatCard3k3desAuth @1275 + uFR_SAM_DesfireFormatCard3k3desAuthM @1276 + uFR_SAM_DesfireFormatCardAesAuth @1277 + uFR_SAM_DesfireFormatCardAesAuthM @1278 + uFR_SAM_DesfireFormatCardDesAuth @1279 + uFR_SAM_DesfireFormatCardDesAuthM @1280 + uFR_SAM_DesfireGetApplicationIds2k3desAuth @1281 + uFR_SAM_DesfireGetApplicationIds2k3desAuthM @1282 + uFR_SAM_DesfireGetApplicationIds3k3desAuth @1283 + uFR_SAM_DesfireGetApplicationIds3k3desAuthM @1284 + uFR_SAM_DesfireGetApplicationIdsAesAuth @1285 + uFR_SAM_DesfireGetApplicationIdsAesAuthM @1286 + uFR_SAM_DesfireGetApplicationIdsDesAuth @1287 + uFR_SAM_DesfireGetApplicationIdsDesAuthM @1288 + uFR_SAM_DesfireGetFileSettings2k3desAuth @1289 + uFR_SAM_DesfireGetFileSettings2k3desAuthM @1290 + uFR_SAM_DesfireGetFileSettings3k3desAuth @1291 + uFR_SAM_DesfireGetFileSettings3k3desAuthM @1292 + uFR_SAM_DesfireGetFileSettingsAesAuth @1293 + uFR_SAM_DesfireGetFileSettingsAesAuthM @1294 + uFR_SAM_DesfireGetFileSettingsDesAuth @1295 + uFR_SAM_DesfireGetFileSettingsDesAuthM @1296 + uFR_SAM_DesfireGetFileSettingsSdmAesAuth @1297 + uFR_SAM_DesfireGetFileSettingsSdmAesAuthM @1298 + uFR_SAM_DesfireGetKeySettings2k3desAuth @1299 + uFR_SAM_DesfireGetKeySettings2k3desAuthM @1300 + uFR_SAM_DesfireGetKeySettings3k3desAuth @1301 + uFR_SAM_DesfireGetKeySettings3k3desAuthM @1302 + uFR_SAM_DesfireGetKeySettingsAesAuth @1303 + uFR_SAM_DesfireGetKeySettingsAesAuthM @1304 + uFR_SAM_DesfireGetKeySettingsDesAuth @1305 + uFR_SAM_DesfireGetKeySettingsDesAuthM @1306 + uFR_SAM_DesfireGetStdFileSize2k3desAuth @1307 + uFR_SAM_DesfireGetStdFileSize2k3desAuthM @1308 + uFR_SAM_DesfireGetStdFileSize3k3desAuth @1309 + uFR_SAM_DesfireGetStdFileSize3k3desAuthM @1310 + uFR_SAM_DesfireGetStdFileSizeAesAuth @1311 + uFR_SAM_DesfireGetStdFileSizeAesAuthM @1312 + uFR_SAM_DesfireGetStdFileSizeDesAuth @1313 + uFR_SAM_DesfireGetStdFileSizeDesAuthM @1314 + uFR_SAM_DesfireIncreaseValueFile2k3desAuth @1315 + uFR_SAM_DesfireIncreaseValueFile2k3desAuthM @1316 + uFR_SAM_DesfireIncreaseValueFile3k3desAuth @1317 + uFR_SAM_DesfireIncreaseValueFile3k3desAuthM @1318 + uFR_SAM_DesfireIncreaseValueFileAesAuth @1319 + uFR_SAM_DesfireIncreaseValueFileAesAuthM @1320 + uFR_SAM_DesfireIncreaseValueFileDesAuth @1321 + uFR_SAM_DesfireIncreaseValueFileDesAuthM @1322 + uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuth @1323 + uFR_SAM_DesfireIncreaseValueFile_TransMac_2k3desAuthM @1324 + uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuth @1325 + uFR_SAM_DesfireIncreaseValueFile_TransMac_3k3desAuthM @1326 + uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuth @1327 + uFR_SAM_DesfireIncreaseValueFile_TransMac_AesAuthM @1328 + uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuth @1329 + uFR_SAM_DesfireIncreaseValueFile_TransMac_DesAuthM @1330 + uFR_SAM_DesfireReadRecords2k3desAuth @1331 + uFR_SAM_DesfireReadRecords2k3desAuthM @1332 + uFR_SAM_DesfireReadRecords3k3desAuth @1333 + uFR_SAM_DesfireReadRecords3k3desAuthM @1334 + uFR_SAM_DesfireReadRecordsAesAuth @1335 + uFR_SAM_DesfireReadRecordsAesAuthM @1336 + uFR_SAM_DesfireReadRecordsDesAuth @1337 + uFR_SAM_DesfireReadRecordsDesAuthM @1338 + uFR_SAM_DesfireReadStdDataFile2k3desAuth @1339 + uFR_SAM_DesfireReadStdDataFile2k3desAuthM @1340 + uFR_SAM_DesfireReadStdDataFile3k3desAuth @1341 + uFR_SAM_DesfireReadStdDataFile3k3desAuthM @1342 + uFR_SAM_DesfireReadStdDataFileAesAuth @1343 + uFR_SAM_DesfireReadStdDataFileAesAuthM @1344 + uFR_SAM_DesfireReadStdDataFileDesAuth @1345 + uFR_SAM_DesfireReadStdDataFileDesAuthM @1346 + uFR_SAM_DesfireReadValueFile2k3desAuth @1347 + uFR_SAM_DesfireReadValueFile2k3desAuthM @1348 + uFR_SAM_DesfireReadValueFile3k3desAuth @1349 + uFR_SAM_DesfireReadValueFile3k3desAuthM @1350 + uFR_SAM_DesfireReadValueFileAesAuth @1351 + uFR_SAM_DesfireReadValueFileAesAuthM @1352 + uFR_SAM_DesfireReadValueFileDesAuth @1353 + uFR_SAM_DesfireReadValueFileDesAuthM @1354 + uFR_SAM_DesfireSetConfiguration2k3desAuth @1355 + uFR_SAM_DesfireSetConfiguration2k3desAuthM @1356 + uFR_SAM_DesfireSetConfiguration3k3desAuth @1357 + uFR_SAM_DesfireSetConfiguration3k3desAuthM @1358 + uFR_SAM_DesfireSetConfigurationAesAuth @1359 + uFR_SAM_DesfireSetConfigurationAesAuthM @1360 + uFR_SAM_DesfireSetConfigurationDesAuth @1361 + uFR_SAM_DesfireSetConfigurationDesAuthM @1362 + uFR_SAM_DesfireSetTransactionTimerAesAuth @1363 + uFR_SAM_DesfireSetTransactionTimerAesAuthM @1364 + uFR_SAM_DesfireWriteBackupDataFile2k3desAuth @1365 + uFR_SAM_DesfireWriteBackupDataFile2k3desAuthM @1366 + uFR_SAM_DesfireWriteBackupDataFile3k3desAuth @1367 + uFR_SAM_DesfireWriteBackupDataFile3k3desAuthM @1368 + uFR_SAM_DesfireWriteBackupDataFileAesAuth @1369 + uFR_SAM_DesfireWriteBackupDataFileAesAuthM @1370 + uFR_SAM_DesfireWriteBackupDataFileDesAuth @1371 + uFR_SAM_DesfireWriteBackupDataFileDesAuthM @1372 + uFR_SAM_DesfireWriteRecord2k3desAuth @1373 + uFR_SAM_DesfireWriteRecord2k3desAuthM @1374 + uFR_SAM_DesfireWriteRecord3k3desAuth @1375 + uFR_SAM_DesfireWriteRecord3k3desAuthM @1376 + uFR_SAM_DesfireWriteRecordAesAuth @1377 + uFR_SAM_DesfireWriteRecordAesAuthM @1378 + uFR_SAM_DesfireWriteRecordDesAuth @1379 + uFR_SAM_DesfireWriteRecordDesAuthM @1380 + uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuth @1381 + uFR_SAM_DesfireWriteRecord_TransMac_2k3desAuthM @1382 + uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuth @1383 + uFR_SAM_DesfireWriteRecord_TransMac_3k3desAuthM @1384 + uFR_SAM_DesfireWriteRecord_TransMac_AesAuth @1385 + uFR_SAM_DesfireWriteRecord_TransMac_AesAuthM @1386 + uFR_SAM_DesfireWriteRecord_TransMac_DesAuth @1387 + uFR_SAM_DesfireWriteRecord_TransMac_DesAuthM @1388 + uFR_SAM_DesfireWriteStdDataFile2k3desAuth @1389 + uFR_SAM_DesfireWriteStdDataFile2k3desAuthM @1390 + uFR_SAM_DesfireWriteStdDataFile3k3desAuth @1391 + uFR_SAM_DesfireWriteStdDataFile3k3desAuthM @1392 + uFR_SAM_DesfireWriteStdDataFileAesAuth @1393 + uFR_SAM_DesfireWriteStdDataFileAesAuthM @1394 + uFR_SAM_DesfireWriteStdDataFileDesAuth @1395 + uFR_SAM_DesfireWriteStdDataFileDesAuthM @1396 + uFR_SAM_GetDesfireUid2k3desAuth @1397 + uFR_SAM_GetDesfireUid2k3desAuthM @1398 + uFR_SAM_GetDesfireUid3k3desAuth @1399 + uFR_SAM_GetDesfireUid3k3desAuthM @1400 + uFR_SAM_GetDesfireUidAesAuth @1401 + uFR_SAM_GetDesfireUidAesAuthM @1402 + uFR_SAM_GetDesfireUidDesAuth @1403 + uFR_SAM_GetDesfireUidDesAuthM @1404 + uFR_i_block_transceive @1405 + uFR_i_block_transceiveM @1406 + uFR_int_DesfireChange2K3DesKey_2k3des @1407 + uFR_int_DesfireChange2K3DesKey_2k3desM @1408 + uFR_int_DesfireChange2K3DesKey_2k3des_PK @1409 + uFR_int_DesfireChange2K3DesKey_2k3des_PK_M @1410 + uFR_int_DesfireChange2K3DesKey_des @1411 + uFR_int_DesfireChange2K3DesKey_desM @1412 + uFR_int_DesfireChange2K3DesKey_des_PK @1413 + uFR_int_DesfireChange2K3DesKey_des_PK_M @1414 + uFR_int_DesfireChange3K3DesKey_3k3des @1415 + uFR_int_DesfireChange3K3DesKey_3k3desM @1416 + uFR_int_DesfireChange3K3DesKey_3k3des_PK @1417 + uFR_int_DesfireChange3K3DesKey_3k3des_PK_M @1418 + uFR_int_DesfireChangeAesKey @1419 + uFR_int_DesfireChangeAesKeyM @1420 + uFR_int_DesfireChangeAesKey_A @1421 + uFR_int_DesfireChangeAesKey_PK @1422 + uFR_int_DesfireChangeAesKey_PK_M @1423 + uFR_int_DesfireChangeAesKey_aes @1424 + uFR_int_DesfireChangeAesKey_aesM @1425 + uFR_int_DesfireChangeAesKey_aes_PK @1426 + uFR_int_DesfireChangeAesKey_aes_PK_M @1427 + uFR_int_DesfireChangeDesKey_2k3des @1428 + uFR_int_DesfireChangeDesKey_2k3desM @1429 + uFR_int_DesfireChangeDesKey_2k3des_PK @1430 + uFR_int_DesfireChangeDesKey_2k3des_PK_M @1431 + uFR_int_DesfireChangeDesKey_des @1432 + uFR_int_DesfireChangeDesKey_desM @1433 + uFR_int_DesfireChangeDesKey_des_PK @1434 + uFR_int_DesfireChangeDesKey_des_PK_M @1435 + uFR_int_DesfireChangeFileSettingsSdm @1436 + uFR_int_DesfireChangeFileSettingsSdmM @1437 + uFR_int_DesfireChangeFileSettingsSdm_PK @1438 + uFR_int_DesfireChangeFileSettingsSdm_PK_M @1439 + uFR_int_DesfireChangeFileSettings_2k3des @1440 + uFR_int_DesfireChangeFileSettings_2k3desM @1441 + uFR_int_DesfireChangeFileSettings_2k3des_PK @1442 + uFR_int_DesfireChangeFileSettings_2k3des_PK_M @1443 + uFR_int_DesfireChangeFileSettings_3k3des @1444 + uFR_int_DesfireChangeFileSettings_3k3desM @1445 + uFR_int_DesfireChangeFileSettings_3k3des_PK @1446 + uFR_int_DesfireChangeFileSettings_3k3des_PK_M @1447 + uFR_int_DesfireChangeFileSettings_aes @1448 + uFR_int_DesfireChangeFileSettings_aesM @1449 + uFR_int_DesfireChangeFileSettings_aes_PK @1450 + uFR_int_DesfireChangeFileSettings_aes_PK_M @1451 + uFR_int_DesfireChangeFileSettings_des @1452 + uFR_int_DesfireChangeFileSettings_desM @1453 + uFR_int_DesfireChangeFileSettings_des_PK @1454 + uFR_int_DesfireChangeFileSettings_des_PK_M @1455 + uFR_int_DesfireChangeKeySettings @1456 + uFR_int_DesfireChangeKeySettingsM @1457 + uFR_int_DesfireChangeKeySettings_2k3des @1458 + uFR_int_DesfireChangeKeySettings_2k3desM @1459 + uFR_int_DesfireChangeKeySettings_2k3des_PK @1460 + uFR_int_DesfireChangeKeySettings_2k3des_PK_M @1461 + uFR_int_DesfireChangeKeySettings_3k3des @1462 + uFR_int_DesfireChangeKeySettings_3k3desM @1463 + uFR_int_DesfireChangeKeySettings_3k3des_PK @1464 + uFR_int_DesfireChangeKeySettings_3k3des_PK_M @1465 + uFR_int_DesfireChangeKeySettings_PK @1466 + uFR_int_DesfireChangeKeySettings_PK_M @1467 + uFR_int_DesfireChangeKeySettings_aes @1468 + uFR_int_DesfireChangeKeySettings_aesM @1469 + uFR_int_DesfireChangeKeySettings_aes_PK @1470 + uFR_int_DesfireChangeKeySettings_aes_PK_M @1471 + uFR_int_DesfireChangeKeySettings_des @1472 + uFR_int_DesfireChangeKeySettings_desM @1473 + uFR_int_DesfireChangeKeySettings_des_PK @1474 + uFR_int_DesfireChangeKeySettings_des_PK_M @1475 + uFR_int_DesfireChangeMasterKey @1476 + uFR_int_DesfireChangeMasterKeyM @1477 + uFR_int_DesfireChangeMasterKey_PK @1478 + uFR_int_DesfireChangeMasterKey_PK_M @1479 + uFR_int_DesfireClearRecordFile @1480 + uFR_int_DesfireClearRecordFile_2k3des @1481 + uFR_int_DesfireClearRecordFile_2k3desM @1482 + uFR_int_DesfireClearRecordFile_2k3des_2 @1483 + uFR_int_DesfireClearRecordFile_2k3des_2M @1484 + uFR_int_DesfireClearRecordFile_2k3des_PK @1485 + uFR_int_DesfireClearRecordFile_2k3des_PK_2 @1486 + uFR_int_DesfireClearRecordFile_2k3des_PK_2M @1487 + uFR_int_DesfireClearRecordFile_2k3des_PK_M @1488 + uFR_int_DesfireClearRecordFile_3k3des @1489 + uFR_int_DesfireClearRecordFile_3k3desM @1490 + uFR_int_DesfireClearRecordFile_3k3des_2 @1491 + uFR_int_DesfireClearRecordFile_3k3des_2M @1492 + uFR_int_DesfireClearRecordFile_3k3des_PK @1493 + uFR_int_DesfireClearRecordFile_3k3des_PK_2 @1494 + uFR_int_DesfireClearRecordFile_3k3des_PK_2M @1495 + uFR_int_DesfireClearRecordFile_3k3des_PK_M @1496 + uFR_int_DesfireClearRecordFile_PK @1497 + uFR_int_DesfireClearRecordFile_PK_2 @1498 + uFR_int_DesfireClearRecordFile_TransMac_2k3des @1499 + uFR_int_DesfireClearRecordFile_TransMac_2k3desM @1500 + uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK @1501 + uFR_int_DesfireClearRecordFile_TransMac_2k3des_PK_M @1502 + uFR_int_DesfireClearRecordFile_TransMac_3k3des @1503 + uFR_int_DesfireClearRecordFile_TransMac_3k3desM @1504 + uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK @1505 + uFR_int_DesfireClearRecordFile_TransMac_3k3des_PK_M @1506 + uFR_int_DesfireClearRecordFile_TransMac_aes @1507 + uFR_int_DesfireClearRecordFile_TransMac_aesM @1508 + uFR_int_DesfireClearRecordFile_TransMac_aes_PK @1509 + uFR_int_DesfireClearRecordFile_TransMac_aes_PK_M @1510 + uFR_int_DesfireClearRecordFile_TransMac_des @1511 + uFR_int_DesfireClearRecordFile_TransMac_desM @1512 + uFR_int_DesfireClearRecordFile_TransMac_des_PK @1513 + uFR_int_DesfireClearRecordFile_TransMac_des_PK_M @1514 + uFR_int_DesfireClearRecordFile_TransMac_no_auth @1515 + uFR_int_DesfireClearRecordFile_TransMac_no_auth_M @1516 + uFR_int_DesfireClearRecordFile_aes @1517 + uFR_int_DesfireClearRecordFile_aesM @1518 + uFR_int_DesfireClearRecordFile_aes_2 @1519 + uFR_int_DesfireClearRecordFile_aes_2M @1520 + uFR_int_DesfireClearRecordFile_aes_PK @1521 + uFR_int_DesfireClearRecordFile_aes_PK_2 @1522 + uFR_int_DesfireClearRecordFile_aes_PK_2M @1523 + uFR_int_DesfireClearRecordFile_aes_PK_M @1524 + uFR_int_DesfireClearRecordFile_des @1525 + uFR_int_DesfireClearRecordFile_desM @1526 + uFR_int_DesfireClearRecordFile_des_2 @1527 + uFR_int_DesfireClearRecordFile_des_2M @1528 + uFR_int_DesfireClearRecordFile_des_PK @1529 + uFR_int_DesfireClearRecordFile_des_PK_2 @1530 + uFR_int_DesfireClearRecordFile_des_PK_2M @1531 + uFR_int_DesfireClearRecordFile_des_PK_M @1532 + uFR_int_DesfireClearRecordFile_no_auth @1533 + uFR_int_DesfireClearRecordFile_no_authM @1534 + uFR_int_DesfireCreate3k3desApplication_2k3des @1535 + uFR_int_DesfireCreate3k3desApplication_2k3desM @1536 + uFR_int_DesfireCreate3k3desApplication_2k3des_PK @1537 + uFR_int_DesfireCreate3k3desApplication_2k3des_PK_M @1538 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso @1539 + uFR_int_DesfireCreate3k3desApplication_2k3des_isoM @1540 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK @1541 + uFR_int_DesfireCreate3k3desApplication_2k3des_iso_PK_M @1542 + uFR_int_DesfireCreate3k3desApplication_3k3des @1543 + uFR_int_DesfireCreate3k3desApplication_3k3desM @1544 + uFR_int_DesfireCreate3k3desApplication_3k3des_PK @1545 + uFR_int_DesfireCreate3k3desApplication_3k3des_PK_M @1546 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso @1547 + uFR_int_DesfireCreate3k3desApplication_3k3des_isoM @1548 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK @1549 + uFR_int_DesfireCreate3k3desApplication_3k3des_iso_PK_M @1550 + uFR_int_DesfireCreate3k3desApplication_aes @1551 + uFR_int_DesfireCreate3k3desApplication_aesM @1552 + uFR_int_DesfireCreate3k3desApplication_aes_PK @1553 + uFR_int_DesfireCreate3k3desApplication_aes_PK_M @1554 + uFR_int_DesfireCreate3k3desApplication_aes_iso @1555 + uFR_int_DesfireCreate3k3desApplication_aes_isoM @1556 + uFR_int_DesfireCreate3k3desApplication_aes_iso_PK @1557 + uFR_int_DesfireCreate3k3desApplication_aes_iso_PK_M @1558 + uFR_int_DesfireCreate3k3desApplication_des @1559 + uFR_int_DesfireCreate3k3desApplication_desM @1560 + uFR_int_DesfireCreate3k3desApplication_des_PK @1561 + uFR_int_DesfireCreate3k3desApplication_des_PK_M @1562 + uFR_int_DesfireCreate3k3desApplication_des_iso @1563 + uFR_int_DesfireCreate3k3desApplication_des_isoM @1564 + uFR_int_DesfireCreate3k3desApplication_des_iso_PK @1565 + uFR_int_DesfireCreate3k3desApplication_des_iso_PK_M @1566 + uFR_int_DesfireCreate3k3desApplication_no_auth @1567 + uFR_int_DesfireCreate3k3desApplication_no_auth_M @1568 + uFR_int_DesfireCreate3k3desApplication_no_auth_iso @1569 + uFR_int_DesfireCreate3k3desApplication_no_auth_isoM @1570 + uFR_int_DesfireCreateAesApplication @1571 + uFR_int_DesfireCreateAesApplicationM @1572 + uFR_int_DesfireCreateAesApplication_2k3des @1573 + uFR_int_DesfireCreateAesApplication_2k3desM @1574 + uFR_int_DesfireCreateAesApplication_2k3des_PK @1575 + uFR_int_DesfireCreateAesApplication_2k3des_PK_M @1576 + uFR_int_DesfireCreateAesApplication_2k3des_iso @1577 + uFR_int_DesfireCreateAesApplication_2k3des_isoM @1578 + uFR_int_DesfireCreateAesApplication_2k3des_iso_PK @1579 + uFR_int_DesfireCreateAesApplication_2k3des_iso_PK_M @1580 + uFR_int_DesfireCreateAesApplication_3k3des @1581 + uFR_int_DesfireCreateAesApplication_3k3desM @1582 + uFR_int_DesfireCreateAesApplication_3k3des_PK @1583 + uFR_int_DesfireCreateAesApplication_3k3des_PK_M @1584 + uFR_int_DesfireCreateAesApplication_3k3des_iso @1585 + uFR_int_DesfireCreateAesApplication_3k3des_isoM @1586 + uFR_int_DesfireCreateAesApplication_3k3des_iso_PK @1587 + uFR_int_DesfireCreateAesApplication_3k3des_iso_PK_M @1588 + uFR_int_DesfireCreateAesApplication_PK @1589 + uFR_int_DesfireCreateAesApplication_PK_M @1590 + uFR_int_DesfireCreateAesApplication_aes @1591 + uFR_int_DesfireCreateAesApplication_aesM @1592 + uFR_int_DesfireCreateAesApplication_aes_PK @1593 + uFR_int_DesfireCreateAesApplication_aes_PK_M @1594 + uFR_int_DesfireCreateAesApplication_aes_iso @1595 + uFR_int_DesfireCreateAesApplication_aes_isoM @1596 + uFR_int_DesfireCreateAesApplication_aes_iso_PK @1597 + uFR_int_DesfireCreateAesApplication_aes_iso_PK_M @1598 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd @1599 + uFR_int_DesfireCreateAesApplication_aes_iso_ascdM @1600 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK @1601 + uFR_int_DesfireCreateAesApplication_aes_iso_ascd_PK_M @1602 + uFR_int_DesfireCreateAesApplication_des @1603 + uFR_int_DesfireCreateAesApplication_desM @1604 + uFR_int_DesfireCreateAesApplication_des_PK @1605 + uFR_int_DesfireCreateAesApplication_des_PK_M @1606 + uFR_int_DesfireCreateAesApplication_des_iso @1607 + uFR_int_DesfireCreateAesApplication_des_isoM @1608 + uFR_int_DesfireCreateAesApplication_des_iso_PK @1609 + uFR_int_DesfireCreateAesApplication_des_iso_PK_M @1610 + uFR_int_DesfireCreateAesApplication_no_auth @1611 + uFR_int_DesfireCreateAesApplication_no_auth_M @1612 + uFR_int_DesfireCreateAesApplication_no_auth_iso @1613 + uFR_int_DesfireCreateAesApplication_no_auth_isoM @1614 + uFR_int_DesfireCreateBackupDataFile_2k3des @1615 + uFR_int_DesfireCreateBackupDataFile_2k3desM @1616 + uFR_int_DesfireCreateBackupDataFile_2k3des_PK @1617 + uFR_int_DesfireCreateBackupDataFile_2k3des_PK_M @1618 + uFR_int_DesfireCreateBackupDataFile_3k3des @1619 + uFR_int_DesfireCreateBackupDataFile_3k3desM @1620 + uFR_int_DesfireCreateBackupDataFile_3k3des_PK @1621 + uFR_int_DesfireCreateBackupDataFile_3k3des_PK_M @1622 + uFR_int_DesfireCreateBackupDataFile_PK @1623 + uFR_int_DesfireCreateBackupDataFile_aes @1624 + uFR_int_DesfireCreateBackupDataFile_aesM @1625 + uFR_int_DesfireCreateBackupDataFile_aes_PK @1626 + uFR_int_DesfireCreateBackupDataFile_aes_PK_M @1627 + uFR_int_DesfireCreateBackupDataFile_des @1628 + uFR_int_DesfireCreateBackupDataFile_desM @1629 + uFR_int_DesfireCreateBackupDataFile_des_PK @1630 + uFR_int_DesfireCreateBackupDataFile_des_PK_M @1631 + uFR_int_DesfireCreateBackupDataFile_no_auth @1632 + uFR_int_DesfireCreateBackupDataFile_no_auth_M @1633 + uFR_int_DesfireCreateCyclicRecordFile_2k3des @1634 + uFR_int_DesfireCreateCyclicRecordFile_2k3desM @1635 + uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK @1636 + uFR_int_DesfireCreateCyclicRecordFile_2k3des_PK_M @1637 + uFR_int_DesfireCreateCyclicRecordFile_3k3des @1638 + uFR_int_DesfireCreateCyclicRecordFile_3k3desM @1639 + uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK @1640 + uFR_int_DesfireCreateCyclicRecordFile_3k3des_PK_M @1641 + uFR_int_DesfireCreateCyclicRecordFile_aes @1642 + uFR_int_DesfireCreateCyclicRecordFile_aesM @1643 + uFR_int_DesfireCreateCyclicRecordFile_aes_PK @1644 + uFR_int_DesfireCreateCyclicRecordFile_aes_PK_M @1645 + uFR_int_DesfireCreateCyclicRecordFile_des @1646 + uFR_int_DesfireCreateCyclicRecordFile_desM @1647 + uFR_int_DesfireCreateCyclicRecordFile_des_PK @1648 + uFR_int_DesfireCreateCyclicRecordFile_des_PK_M @1649 + uFR_int_DesfireCreateCyclicRecordFile_no_auth @1650 + uFR_int_DesfireCreateCyclicRecordFile_no_authM @1651 + uFR_int_DesfireCreateDesApplication_2k3des @1652 + uFR_int_DesfireCreateDesApplication_2k3desM @1653 + uFR_int_DesfireCreateDesApplication_2k3des_PK @1654 + uFR_int_DesfireCreateDesApplication_2k3des_PK_M @1655 + uFR_int_DesfireCreateDesApplication_2k3des_iso @1656 + uFR_int_DesfireCreateDesApplication_2k3des_isoM @1657 + uFR_int_DesfireCreateDesApplication_2k3des_iso_PK @1658 + uFR_int_DesfireCreateDesApplication_2k3des_iso_PK_M @1659 + uFR_int_DesfireCreateDesApplication_3k3des @1660 + uFR_int_DesfireCreateDesApplication_3k3desM @1661 + uFR_int_DesfireCreateDesApplication_3k3des_PK @1662 + uFR_int_DesfireCreateDesApplication_3k3des_PK_M @1663 + uFR_int_DesfireCreateDesApplication_3k3des_iso @1664 + uFR_int_DesfireCreateDesApplication_3k3des_isoM @1665 + uFR_int_DesfireCreateDesApplication_3k3des_iso_PK @1666 + uFR_int_DesfireCreateDesApplication_3k3des_iso_PK_M @1667 + uFR_int_DesfireCreateDesApplication_aes @1668 + uFR_int_DesfireCreateDesApplication_aesM @1669 + uFR_int_DesfireCreateDesApplication_aes_PK @1670 + uFR_int_DesfireCreateDesApplication_aes_PK_M @1671 + uFR_int_DesfireCreateDesApplication_aes_iso @1672 + uFR_int_DesfireCreateDesApplication_aes_isoM @1673 + uFR_int_DesfireCreateDesApplication_aes_iso_PK @1674 + uFR_int_DesfireCreateDesApplication_aes_iso_PK_M @1675 + uFR_int_DesfireCreateDesApplication_des @1676 + uFR_int_DesfireCreateDesApplication_desM @1677 + uFR_int_DesfireCreateDesApplication_des_PK @1678 + uFR_int_DesfireCreateDesApplication_des_PK_M @1679 + uFR_int_DesfireCreateDesApplication_des_iso @1680 + uFR_int_DesfireCreateDesApplication_des_isoM @1681 + uFR_int_DesfireCreateDesApplication_des_iso_PK @1682 + uFR_int_DesfireCreateDesApplication_des_iso_PK_M @1683 + uFR_int_DesfireCreateDesApplication_no_auth @1684 + uFR_int_DesfireCreateDesApplication_no_auth_M @1685 + uFR_int_DesfireCreateDesApplication_no_auth_iso @1686 + uFR_int_DesfireCreateDesApplication_no_auth_isoM @1687 + uFR_int_DesfireCreateLinearRecordFile_2k3des @1688 + uFR_int_DesfireCreateLinearRecordFile_2k3desM @1689 + uFR_int_DesfireCreateLinearRecordFile_2k3des_PK @1690 + uFR_int_DesfireCreateLinearRecordFile_2k3des_PK_M @1691 + uFR_int_DesfireCreateLinearRecordFile_3k3des @1692 + uFR_int_DesfireCreateLinearRecordFile_3k3desM @1693 + uFR_int_DesfireCreateLinearRecordFile_3k3des_PK @1694 + uFR_int_DesfireCreateLinearRecordFile_3k3des_PK_M @1695 + uFR_int_DesfireCreateLinearRecordFile_aes @1696 + uFR_int_DesfireCreateLinearRecordFile_aesM @1697 + uFR_int_DesfireCreateLinearRecordFile_aes_PK @1698 + uFR_int_DesfireCreateLinearRecordFile_aes_PK_M @1699 + uFR_int_DesfireCreateLinearRecordFile_des @1700 + uFR_int_DesfireCreateLinearRecordFile_desM @1701 + uFR_int_DesfireCreateLinearRecordFile_des_PK @1702 + uFR_int_DesfireCreateLinearRecordFile_des_PK_M @1703 + uFR_int_DesfireCreateLinearRecordFile_no_auth @1704 + uFR_int_DesfireCreateLinearRecordFile_no_authM @1705 + uFR_int_DesfireCreateStdDataFile @1706 + uFR_int_DesfireCreateStdDataFileM @1707 + uFR_int_DesfireCreateStdDataFile_2k3des @1708 + uFR_int_DesfireCreateStdDataFile_2k3desM @1709 + uFR_int_DesfireCreateStdDataFile_2k3des_PK @1710 + uFR_int_DesfireCreateStdDataFile_2k3des_PK_M @1711 + uFR_int_DesfireCreateStdDataFile_2k3des_iso @1712 + uFR_int_DesfireCreateStdDataFile_2k3des_isoM @1713 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK @1714 + uFR_int_DesfireCreateStdDataFile_2k3des_iso_PK_M @1715 + uFR_int_DesfireCreateStdDataFile_3k3des @1716 + uFR_int_DesfireCreateStdDataFile_3k3desM @1717 + uFR_int_DesfireCreateStdDataFile_3k3des_PK @1718 + uFR_int_DesfireCreateStdDataFile_3k3des_PK_M @1719 + uFR_int_DesfireCreateStdDataFile_3k3des_iso @1720 + uFR_int_DesfireCreateStdDataFile_3k3des_isoM @1721 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK @1722 + uFR_int_DesfireCreateStdDataFile_3k3des_iso_PK_M @1723 + uFR_int_DesfireCreateStdDataFile_PK @1724 + uFR_int_DesfireCreateStdDataFile_PK_M @1725 + uFR_int_DesfireCreateStdDataFile_aes @1726 + uFR_int_DesfireCreateStdDataFile_aesM @1727 + uFR_int_DesfireCreateStdDataFile_aes_PK @1728 + uFR_int_DesfireCreateStdDataFile_aes_PK_M @1729 + uFR_int_DesfireCreateStdDataFile_aes_iso @1730 + uFR_int_DesfireCreateStdDataFile_aes_isoM @1731 + uFR_int_DesfireCreateStdDataFile_aes_iso_PK @1732 + uFR_int_DesfireCreateStdDataFile_aes_iso_PK_M @1733 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm @1734 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdmM @1735 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK @1736 + uFR_int_DesfireCreateStdDataFile_aes_iso_sdm_PK_M @1737 + uFR_int_DesfireCreateStdDataFile_des @1738 + uFR_int_DesfireCreateStdDataFile_desM @1739 + uFR_int_DesfireCreateStdDataFile_des_PK @1740 + uFR_int_DesfireCreateStdDataFile_des_PK_M @1741 + uFR_int_DesfireCreateStdDataFile_des_iso @1742 + uFR_int_DesfireCreateStdDataFile_des_isoM @1743 + uFR_int_DesfireCreateStdDataFile_des_iso_PK @1744 + uFR_int_DesfireCreateStdDataFile_des_iso_PK_M @1745 + uFR_int_DesfireCreateStdDataFile_no_auth @1746 + uFR_int_DesfireCreateStdDataFile_no_auth_M @1747 + uFR_int_DesfireCreateStdDataFile_no_auth_iso @1748 + uFR_int_DesfireCreateStdDataFile_no_auth_isoM @1749 + uFR_int_DesfireCreateTransMacFile_2k3des @1750 + uFR_int_DesfireCreateTransMacFile_2k3des_M @1751 + uFR_int_DesfireCreateTransMacFile_2k3des_PK @1752 + uFR_int_DesfireCreateTransMacFile_2k3des_PK_M @1753 + uFR_int_DesfireCreateTransMacFile_3k3des @1754 + uFR_int_DesfireCreateTransMacFile_3k3des_M @1755 + uFR_int_DesfireCreateTransMacFile_3k3des_PK @1756 + uFR_int_DesfireCreateTransMacFile_3k3des_PK_M @1757 + uFR_int_DesfireCreateTransMacFile_aes @1758 + uFR_int_DesfireCreateTransMacFile_aes_M @1759 + uFR_int_DesfireCreateTransMacFile_aes_PK @1760 + uFR_int_DesfireCreateTransMacFile_aes_PK_M @1761 + uFR_int_DesfireCreateTransMacFile_des @1762 + uFR_int_DesfireCreateTransMacFile_des_M @1763 + uFR_int_DesfireCreateTransMacFile_des_PK @1764 + uFR_int_DesfireCreateTransMacFile_des_PK_M @1765 + uFR_int_DesfireCreateValueFile @1766 + uFR_int_DesfireCreateValueFileM @1767 + uFR_int_DesfireCreateValueFile_2k3des @1768 + uFR_int_DesfireCreateValueFile_2k3desM @1769 + uFR_int_DesfireCreateValueFile_2k3des_PK @1770 + uFR_int_DesfireCreateValueFile_2k3des_PK_M @1771 + uFR_int_DesfireCreateValueFile_3k3des @1772 + uFR_int_DesfireCreateValueFile_3k3desM @1773 + uFR_int_DesfireCreateValueFile_3k3des_PK @1774 + uFR_int_DesfireCreateValueFile_3k3des_PK_M @1775 + uFR_int_DesfireCreateValueFile_PK @1776 + uFR_int_DesfireCreateValueFile_PK_M @1777 + uFR_int_DesfireCreateValueFile_aes @1778 + uFR_int_DesfireCreateValueFile_aesM @1779 + uFR_int_DesfireCreateValueFile_aes_PK @1780 + uFR_int_DesfireCreateValueFile_aes_PK_M @1781 + uFR_int_DesfireCreateValueFile_des @1782 + uFR_int_DesfireCreateValueFile_desM @1783 + uFR_int_DesfireCreateValueFile_des_PK @1784 + uFR_int_DesfireCreateValueFile_des_PK_M @1785 + uFR_int_DesfireCreateValueFile_no_auth @1786 + uFR_int_DesfireCreateValueFile_no_auth_M @1787 + uFR_int_DesfireDecreaseValueFile @1788 + uFR_int_DesfireDecreaseValueFileM @1789 + uFR_int_DesfireDecreaseValueFile_2k3des @1790 + uFR_int_DesfireDecreaseValueFile_2k3desM @1791 + uFR_int_DesfireDecreaseValueFile_2k3des_PK @1792 + uFR_int_DesfireDecreaseValueFile_2k3des_PK_M @1793 + uFR_int_DesfireDecreaseValueFile_3k3des @1794 + uFR_int_DesfireDecreaseValueFile_3k3desM @1795 + uFR_int_DesfireDecreaseValueFile_3k3des_PK @1796 + uFR_int_DesfireDecreaseValueFile_3k3des_PK_M @1797 + uFR_int_DesfireDecreaseValueFile_PK @1798 + uFR_int_DesfireDecreaseValueFile_PK_M @1799 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des @1800 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3desM @1801 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK @1802 + uFR_int_DesfireDecreaseValueFile_TransMac_2k3des_PK_M @1803 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des @1804 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3desM @1805 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK @1806 + uFR_int_DesfireDecreaseValueFile_TransMac_3k3des_PK_M @1807 + uFR_int_DesfireDecreaseValueFile_TransMac_aes @1808 + uFR_int_DesfireDecreaseValueFile_TransMac_aesM @1809 + uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK @1810 + uFR_int_DesfireDecreaseValueFile_TransMac_aes_PK_M @1811 + uFR_int_DesfireDecreaseValueFile_TransMac_des @1812 + uFR_int_DesfireDecreaseValueFile_TransMac_desM @1813 + uFR_int_DesfireDecreaseValueFile_TransMac_des_PK @1814 + uFR_int_DesfireDecreaseValueFile_TransMac_des_PK_M @1815 + uFR_int_DesfireDecreaseValueFile_TransMac_no_auth @1816 + uFR_int_DesfireDecreaseValueFile_TransMac_no_auth_M @1817 + uFR_int_DesfireDecreaseValueFile_aes @1818 + uFR_int_DesfireDecreaseValueFile_aesM @1819 + uFR_int_DesfireDecreaseValueFile_aes_PK @1820 + uFR_int_DesfireDecreaseValueFile_aes_PK_M @1821 + uFR_int_DesfireDecreaseValueFile_des @1822 + uFR_int_DesfireDecreaseValueFile_desM @1823 + uFR_int_DesfireDecreaseValueFile_des_PK @1824 + uFR_int_DesfireDecreaseValueFile_des_PK_M @1825 + uFR_int_DesfireDecreaseValueFile_no_auth @1826 + uFR_int_DesfireDecreaseValueFile_no_auth_M @1827 + uFR_int_DesfireDeleteApplication @1828 + uFR_int_DesfireDeleteApplicationM @1829 + uFR_int_DesfireDeleteApplication_2k3des @1830 + uFR_int_DesfireDeleteApplication_2k3desM @1831 + uFR_int_DesfireDeleteApplication_2k3des_PK @1832 + uFR_int_DesfireDeleteApplication_2k3des_PK_M @1833 + uFR_int_DesfireDeleteApplication_3k3des @1834 + uFR_int_DesfireDeleteApplication_3k3desM @1835 + uFR_int_DesfireDeleteApplication_3k3des_PK @1836 + uFR_int_DesfireDeleteApplication_3k3des_PK_M @1837 + uFR_int_DesfireDeleteApplication_PK @1838 + uFR_int_DesfireDeleteApplication_PK_M @1839 + uFR_int_DesfireDeleteApplication_aes @1840 + uFR_int_DesfireDeleteApplication_aesM @1841 + uFR_int_DesfireDeleteApplication_aes_PK @1842 + uFR_int_DesfireDeleteApplication_aes_PK_M @1843 + uFR_int_DesfireDeleteApplication_app_master_2k3des @1844 + uFR_int_DesfireDeleteApplication_app_master_2k3desM @1845 + uFR_int_DesfireDeleteApplication_app_master_2k3des_PK @1846 + uFR_int_DesfireDeleteApplication_app_master_2k3des_PK_M @1847 + uFR_int_DesfireDeleteApplication_app_master_3k3des @1848 + uFR_int_DesfireDeleteApplication_app_master_3k3desM @1849 + uFR_int_DesfireDeleteApplication_app_master_3k3des_PK @1850 + uFR_int_DesfireDeleteApplication_app_master_3k3des_PK_M @1851 + uFR_int_DesfireDeleteApplication_app_master_PK @1852 + uFR_int_DesfireDeleteApplication_app_master_aes @1853 + uFR_int_DesfireDeleteApplication_app_master_aesM @1854 + uFR_int_DesfireDeleteApplication_app_master_aes_PK @1855 + uFR_int_DesfireDeleteApplication_app_master_aes_PK_M @1856 + uFR_int_DesfireDeleteApplication_app_master_des @1857 + uFR_int_DesfireDeleteApplication_app_master_desM @1858 + uFR_int_DesfireDeleteApplication_app_master_des_PK @1859 + uFR_int_DesfireDeleteApplication_app_master_des_PK_M @1860 + uFR_int_DesfireDeleteApplication_des @1861 + uFR_int_DesfireDeleteApplication_desM @1862 + uFR_int_DesfireDeleteApplication_des_PK @1863 + uFR_int_DesfireDeleteApplication_des_PK_M @1864 + uFR_int_DesfireDeleteFile @1865 + uFR_int_DesfireDeleteFileM @1866 + uFR_int_DesfireDeleteFile_2k3des @1867 + uFR_int_DesfireDeleteFile_2k3desM @1868 + uFR_int_DesfireDeleteFile_2k3des_PK @1869 + uFR_int_DesfireDeleteFile_2k3des_PK_M @1870 + uFR_int_DesfireDeleteFile_3k3des @1871 + uFR_int_DesfireDeleteFile_3k3desM @1872 + uFR_int_DesfireDeleteFile_3k3des_PK @1873 + uFR_int_DesfireDeleteFile_3k3des_PK_M @1874 + uFR_int_DesfireDeleteFile_PK @1875 + uFR_int_DesfireDeleteFile_PK_M @1876 + uFR_int_DesfireDeleteFile_aes @1877 + uFR_int_DesfireDeleteFile_aesM @1878 + uFR_int_DesfireDeleteFile_aes_PK @1879 + uFR_int_DesfireDeleteFile_aes_PK_M @1880 + uFR_int_DesfireDeleteFile_des @1881 + uFR_int_DesfireDeleteFile_desM @1882 + uFR_int_DesfireDeleteFile_des_PK @1883 + uFR_int_DesfireDeleteFile_des_PK_M @1884 + uFR_int_DesfireDeleteFile_no_auth @1885 + uFR_int_DesfireDeleteFile_no_auth_M @1886 + uFR_int_DesfireFormatCard @1887 + uFR_int_DesfireFormatCardM @1888 + uFR_int_DesfireFormatCard_2k3des @1889 + uFR_int_DesfireFormatCard_2k3desM @1890 + uFR_int_DesfireFormatCard_2k3des_PK @1891 + uFR_int_DesfireFormatCard_2k3des_PK_M @1892 + uFR_int_DesfireFormatCard_3k3des @1893 + uFR_int_DesfireFormatCard_3k3desM @1894 + uFR_int_DesfireFormatCard_3k3des_PK @1895 + uFR_int_DesfireFormatCard_3k3des_PK_M @1896 + uFR_int_DesfireFormatCard_PK @1897 + uFR_int_DesfireFormatCard_PK_M @1898 + uFR_int_DesfireFormatCard_aes @1899 + uFR_int_DesfireFormatCard_aesM @1900 + uFR_int_DesfireFormatCard_aes_PK @1901 + uFR_int_DesfireFormatCard_aes_PK_M @1902 + uFR_int_DesfireFormatCard_des @1903 + uFR_int_DesfireFormatCard_desM @1904 + uFR_int_DesfireFormatCard_des_PK @1905 + uFR_int_DesfireFormatCard_des_PK_M @1906 + uFR_int_DesfireFreeMem @1907 + uFR_int_DesfireFreeMemM @1908 + uFR_int_DesfireGetApplicationIds @1909 + uFR_int_DesfireGetApplicationIdsM @1910 + uFR_int_DesfireGetApplicationIds_2k3des @1911 + uFR_int_DesfireGetApplicationIds_2k3desM @1912 + uFR_int_DesfireGetApplicationIds_2k3des_PK @1913 + uFR_int_DesfireGetApplicationIds_2k3des_PK_M @1914 + uFR_int_DesfireGetApplicationIds_3k3des @1915 + uFR_int_DesfireGetApplicationIds_3k3desM @1916 + uFR_int_DesfireGetApplicationIds_3k3des_PK @1917 + uFR_int_DesfireGetApplicationIds_3k3des_PK_M @1918 + uFR_int_DesfireGetApplicationIds_PK @1919 + uFR_int_DesfireGetApplicationIds_PK_M @1920 + uFR_int_DesfireGetApplicationIds_aes @1921 + uFR_int_DesfireGetApplicationIds_aesM @1922 + uFR_int_DesfireGetApplicationIds_aes_PK @1923 + uFR_int_DesfireGetApplicationIds_aes_PK_M @1924 + uFR_int_DesfireGetApplicationIds_des @1925 + uFR_int_DesfireGetApplicationIds_desM @1926 + uFR_int_DesfireGetApplicationIds_des_PK @1927 + uFR_int_DesfireGetApplicationIds_des_PK_M @1928 + uFR_int_DesfireGetApplicationIds_no_auth @1929 + uFR_int_DesfireGetApplicationIds_no_auth_M @1930 + uFR_int_DesfireGetFileSettingsSdm_aes @1931 + uFR_int_DesfireGetFileSettingsSdm_aes_M @1932 + uFR_int_DesfireGetFileSettingsSdm_aes_PK @1933 + uFR_int_DesfireGetFileSettingsSdm_aes_PK_M @1934 + uFR_int_DesfireGetFileSettings_2k3des @1935 + uFR_int_DesfireGetFileSettings_2k3des_M @1936 + uFR_int_DesfireGetFileSettings_2k3des_PK @1937 + uFR_int_DesfireGetFileSettings_2k3des_PK_M @1938 + uFR_int_DesfireGetFileSettings_3k3des @1939 + uFR_int_DesfireGetFileSettings_3k3des_M @1940 + uFR_int_DesfireGetFileSettings_3k3des_PK @1941 + uFR_int_DesfireGetFileSettings_3k3des_PK_M @1942 + uFR_int_DesfireGetFileSettings_aes @1943 + uFR_int_DesfireGetFileSettings_aes_M @1944 + uFR_int_DesfireGetFileSettings_aes_PK @1945 + uFR_int_DesfireGetFileSettings_aes_PK_M @1946 + uFR_int_DesfireGetFileSettings_des @1947 + uFR_int_DesfireGetFileSettings_des_M @1948 + uFR_int_DesfireGetFileSettings_des_PK @1949 + uFR_int_DesfireGetFileSettings_des_PK_M @1950 + uFR_int_DesfireGetFileSettings_no_auth @1951 + uFR_int_DesfireGetFileSettings_no_auth_M @1952 + uFR_int_DesfireGetKeySettings @1953 + uFR_int_DesfireGetKeySettingsM @1954 + uFR_int_DesfireGetKeySettings_2k3des @1955 + uFR_int_DesfireGetKeySettings_2k3desM @1956 + uFR_int_DesfireGetKeySettings_2k3des_PK @1957 + uFR_int_DesfireGetKeySettings_2k3des_PK_M @1958 + uFR_int_DesfireGetKeySettings_3k3des @1959 + uFR_int_DesfireGetKeySettings_3k3desM @1960 + uFR_int_DesfireGetKeySettings_3k3des_PK @1961 + uFR_int_DesfireGetKeySettings_3k3des_PK_M @1962 + uFR_int_DesfireGetKeySettings_PK @1963 + uFR_int_DesfireGetKeySettings_PK_M @1964 + uFR_int_DesfireGetKeySettings_aes @1965 + uFR_int_DesfireGetKeySettings_aesM @1966 + uFR_int_DesfireGetKeySettings_aes_PK @1967 + uFR_int_DesfireGetKeySettings_aes_PK_M @1968 + uFR_int_DesfireGetKeySettings_des @1969 + uFR_int_DesfireGetKeySettings_desM @1970 + uFR_int_DesfireGetKeySettings_des_PK @1971 + uFR_int_DesfireGetKeySettings_des_PK_M @1972 + uFR_int_DesfireGetKeySettings_no_auth @1973 + uFR_int_DesfireGetKeySettings_no_auth_M @1974 + uFR_int_DesfireGetStdFileSize_2k3des @1975 + uFR_int_DesfireGetStdFileSize_2k3des_M @1976 + uFR_int_DesfireGetStdFileSize_2k3des_PK @1977 + uFR_int_DesfireGetStdFileSize_2k3des_PK_M @1978 + uFR_int_DesfireGetStdFileSize_3k3des @1979 + uFR_int_DesfireGetStdFileSize_3k3des_M @1980 + uFR_int_DesfireGetStdFileSize_3k3des_PK @1981 + uFR_int_DesfireGetStdFileSize_3k3des_PK_M @1982 + uFR_int_DesfireGetStdFileSize_aes @1983 + uFR_int_DesfireGetStdFileSize_aes_M @1984 + uFR_int_DesfireGetStdFileSize_aes_PK @1985 + uFR_int_DesfireGetStdFileSize_aes_PK_M @1986 + uFR_int_DesfireGetStdFileSize_des @1987 + uFR_int_DesfireGetStdFileSize_des_M @1988 + uFR_int_DesfireGetStdFileSize_des_PK @1989 + uFR_int_DesfireGetStdFileSize_des_PK_M @1990 + uFR_int_DesfireGetStdFileSize_no_auth @1991 + uFR_int_DesfireGetStdFileSize_no_auth_M @1992 + uFR_int_DesfireIncreaseValueFile @1993 + uFR_int_DesfireIncreaseValueFileM @1994 + uFR_int_DesfireIncreaseValueFile_2k3des @1995 + uFR_int_DesfireIncreaseValueFile_2k3desM @1996 + uFR_int_DesfireIncreaseValueFile_2k3des_PK @1997 + uFR_int_DesfireIncreaseValueFile_2k3des_PK_M @1998 + uFR_int_DesfireIncreaseValueFile_3k3des @1999 + uFR_int_DesfireIncreaseValueFile_3k3desM @2000 + uFR_int_DesfireIncreaseValueFile_3k3des_PK @2001 + uFR_int_DesfireIncreaseValueFile_3k3des_PK_M @2002 + uFR_int_DesfireIncreaseValueFile_PK @2003 + uFR_int_DesfireIncreaseValueFile_PK_M @2004 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des @2005 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3desM @2006 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK @2007 + uFR_int_DesfireIncreaseValueFile_TransMac_2k3des_PK_M @2008 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des @2009 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3desM @2010 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK @2011 + uFR_int_DesfireIncreaseValueFile_TransMac_3k3des_PK_M @2012 + uFR_int_DesfireIncreaseValueFile_TransMac_aes @2013 + uFR_int_DesfireIncreaseValueFile_TransMac_aesM @2014 + uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK @2015 + uFR_int_DesfireIncreaseValueFile_TransMac_aes_PK_M @2016 + uFR_int_DesfireIncreaseValueFile_TransMac_des @2017 + uFR_int_DesfireIncreaseValueFile_TransMac_desM @2018 + uFR_int_DesfireIncreaseValueFile_TransMac_des_PK @2019 + uFR_int_DesfireIncreaseValueFile_TransMac_des_PK_M @2020 + uFR_int_DesfireIncreaseValueFile_TransMac_no_auth @2021 + uFR_int_DesfireIncreaseValueFile_TransMac_no_auth_M @2022 + uFR_int_DesfireIncreaseValueFile_aes @2023 + uFR_int_DesfireIncreaseValueFile_aesM @2024 + uFR_int_DesfireIncreaseValueFile_aes_PK @2025 + uFR_int_DesfireIncreaseValueFile_aes_PK_M @2026 + uFR_int_DesfireIncreaseValueFile_des @2027 + uFR_int_DesfireIncreaseValueFile_desM @2028 + uFR_int_DesfireIncreaseValueFile_des_PK @2029 + uFR_int_DesfireIncreaseValueFile_des_PK_M @2030 + uFR_int_DesfireIncreaseValueFile_no_auth @2031 + uFR_int_DesfireIncreaseValueFile_no_auth_M @2032 + uFR_int_DesfireNDEFFormat @2033 + uFR_int_DesfireReadNDEFMessage @2034 + uFR_int_DesfireReadNDEFPayload @2035 + uFR_int_DesfireReadRecords_2k3des @2036 + uFR_int_DesfireReadRecords_2k3desM @2037 + uFR_int_DesfireReadRecords_2k3des_PK @2038 + uFR_int_DesfireReadRecords_2k3des_PK_M @2039 + uFR_int_DesfireReadRecords_3k3des @2040 + uFR_int_DesfireReadRecords_3k3desM @2041 + uFR_int_DesfireReadRecords_3k3des_PK @2042 + uFR_int_DesfireReadRecords_3k3des_PK_M @2043 + uFR_int_DesfireReadRecords_aes @2044 + uFR_int_DesfireReadRecords_aesM @2045 + uFR_int_DesfireReadRecords_aes_PK @2046 + uFR_int_DesfireReadRecords_aes_PK_M @2047 + uFR_int_DesfireReadRecords_des @2048 + uFR_int_DesfireReadRecords_desM @2049 + uFR_int_DesfireReadRecords_des_PK @2050 + uFR_int_DesfireReadRecords_des_PK_M @2051 + uFR_int_DesfireReadRecords_no_auth @2052 + uFR_int_DesfireReadRecords_no_authM @2053 + uFR_int_DesfireReadStdDataFile @2054 + uFR_int_DesfireReadStdDataFile_2k3des @2055 + uFR_int_DesfireReadStdDataFile_2k3desM @2056 + uFR_int_DesfireReadStdDataFile_2k3des_PK @2057 + uFR_int_DesfireReadStdDataFile_2k3des_PK_M @2058 + uFR_int_DesfireReadStdDataFile_3k3des @2059 + uFR_int_DesfireReadStdDataFile_3k3desM @2060 + uFR_int_DesfireReadStdDataFile_3k3des_PK @2061 + uFR_int_DesfireReadStdDataFile_3k3des_PK_M @2062 + uFR_int_DesfireReadStdDataFile_PK @2063 + uFR_int_DesfireReadStdDataFile_PK_M @2064 + uFR_int_DesfireReadStdDataFile_aes @2065 + uFR_int_DesfireReadStdDataFile_aesM @2066 + uFR_int_DesfireReadStdDataFile_aes_PK @2067 + uFR_int_DesfireReadStdDataFile_aes_PK_M @2068 + uFR_int_DesfireReadStdDataFile_des @2069 + uFR_int_DesfireReadStdDataFile_desM @2070 + uFR_int_DesfireReadStdDataFile_des_PK @2071 + uFR_int_DesfireReadStdDataFile_des_PK_M @2072 + uFR_int_DesfireReadStdDataFile_no_auth @2073 + uFR_int_DesfireReadStdDataFile_no_auth_M @2074 + uFR_int_DesfireReadStddDataFileM @2075 + uFR_int_DesfireReadStddDataFile_aesM @2076 + uFR_int_DesfireReadValueFile @2077 + uFR_int_DesfireReadValueFileM @2078 + uFR_int_DesfireReadValueFile_2k3des @2079 + uFR_int_DesfireReadValueFile_2k3desM @2080 + uFR_int_DesfireReadValueFile_2k3des_PK @2081 + uFR_int_DesfireReadValueFile_2k3des_PK_M @2082 + uFR_int_DesfireReadValueFile_3k3des @2083 + uFR_int_DesfireReadValueFile_3k3desM @2084 + uFR_int_DesfireReadValueFile_3k3des_PK @2085 + uFR_int_DesfireReadValueFile_3k3des_PK_M @2086 + uFR_int_DesfireReadValueFile_PK @2087 + uFR_int_DesfireReadValueFile_PK_M @2088 + uFR_int_DesfireReadValueFile_aes @2089 + uFR_int_DesfireReadValueFile_aesM @2090 + uFR_int_DesfireReadValueFile_aes_PK @2091 + uFR_int_DesfireReadValueFile_aes_PK_M @2092 + uFR_int_DesfireReadValueFile_des @2093 + uFR_int_DesfireReadValueFile_desM @2094 + uFR_int_DesfireReadValueFile_des_PK @2095 + uFR_int_DesfireReadValueFile_des_PK_M @2096 + uFR_int_DesfireReadValueFile_no_auth @2097 + uFR_int_DesfireReadValueFile_no_auth_M @2098 + uFR_int_DesfireRidReadECCSignature_2k3des @2099 + uFR_int_DesfireRidReadECCSignature_2k3desM @2100 + uFR_int_DesfireRidReadECCSignature_2k3des_PK @2101 + uFR_int_DesfireRidReadECCSignature_2k3des_PK_M @2102 + uFR_int_DesfireRidReadECCSignature_3k3des @2103 + uFR_int_DesfireRidReadECCSignature_3k3desM @2104 + uFR_int_DesfireRidReadECCSignature_3k3des_PK @2105 + uFR_int_DesfireRidReadECCSignature_3k3des_PK_M @2106 + uFR_int_DesfireRidReadECCSignature_aes @2107 + uFR_int_DesfireRidReadECCSignature_aesM @2108 + uFR_int_DesfireRidReadECCSignature_aes_PK @2109 + uFR_int_DesfireRidReadECCSignature_aes_PK_M @2110 + uFR_int_DesfireRidReadECCSignature_des @2111 + uFR_int_DesfireRidReadECCSignature_desM @2112 + uFR_int_DesfireRidReadECCSignature_des_PK @2113 + uFR_int_DesfireRidReadECCSignature_des_PK_M @2114 + uFR_int_DesfireSetConfiguration @2115 + uFR_int_DesfireSetConfigurationM @2116 + uFR_int_DesfireSetConfiguration_2k3des @2117 + uFR_int_DesfireSetConfiguration_2k3desM @2118 + uFR_int_DesfireSetConfiguration_2k3des_PK @2119 + uFR_int_DesfireSetConfiguration_2k3des_PK_M @2120 + uFR_int_DesfireSetConfiguration_3k3des @2121 + uFR_int_DesfireSetConfiguration_3k3desM @2122 + uFR_int_DesfireSetConfiguration_3k3des_PK @2123 + uFR_int_DesfireSetConfiguration_3k3des_PK_M @2124 + uFR_int_DesfireSetConfiguration_PK @2125 + uFR_int_DesfireSetConfiguration_PK_M @2126 + uFR_int_DesfireSetConfiguration_aes @2127 + uFR_int_DesfireSetConfiguration_aesM @2128 + uFR_int_DesfireSetConfiguration_aes_PK @2129 + uFR_int_DesfireSetConfiguration_aes_PK_M @2130 + uFR_int_DesfireSetConfiguration_des @2131 + uFR_int_DesfireSetConfiguration_desM @2132 + uFR_int_DesfireSetConfiguration_des_PK @2133 + uFR_int_DesfireSetConfiguration_des_PK_M @2134 + uFR_int_DesfireSetTransactionTimer_aes @2135 + uFR_int_DesfireSetTransactionTimer_aesM @2136 + uFR_int_DesfireSetTransactionTimer_aes_PK @2137 + uFR_int_DesfireSetTransactionTimer_aes_PK_M @2138 + uFR_int_DesfireUidReadECCSignature @2139 + uFR_int_DesfireUidReadECCSignatureM @2140 + uFR_int_DesfireWriteAesKey @2141 + uFR_int_DesfireWriteAesKeyM @2142 + uFR_int_DesfireWriteBackupDataFile_2k3des @2143 + uFR_int_DesfireWriteBackupDataFile_2k3desM @2144 + uFR_int_DesfireWriteBackupDataFile_2k3des_PK @2145 + uFR_int_DesfireWriteBackupDataFile_2k3des_PK_M @2146 + uFR_int_DesfireWriteBackupDataFile_3k3des @2147 + uFR_int_DesfireWriteBackupDataFile_3k3desM @2148 + uFR_int_DesfireWriteBackupDataFile_3k3des_PK @2149 + uFR_int_DesfireWriteBackupDataFile_3k3des_PK_M @2150 + uFR_int_DesfireWriteBackupDataFile_aes @2151 + uFR_int_DesfireWriteBackupDataFile_aesM @2152 + uFR_int_DesfireWriteBackupDataFile_aes_PK @2153 + uFR_int_DesfireWriteBackupDataFile_aes_PK_M @2154 + uFR_int_DesfireWriteBackupDataFile_des @2155 + uFR_int_DesfireWriteBackupDataFile_desM @2156 + uFR_int_DesfireWriteBackupDataFile_des_PK @2157 + uFR_int_DesfireWriteBackupDataFile_des_PK_M @2158 + uFR_int_DesfireWriteBackupDataFile_no_auth @2159 + uFR_int_DesfireWriteBackupDataFile_no_auth_M @2160 + uFR_int_DesfireWriteKey @2161 + uFR_int_DesfireWriteKeyM @2162 + uFR_int_DesfireWriteNDEFMessage @2163 + uFR_int_DesfireWriteNDEFPayload @2164 + uFR_int_DesfireWriteRecord_2k3des @2165 + uFR_int_DesfireWriteRecord_2k3desM @2166 + uFR_int_DesfireWriteRecord_2k3des_PK @2167 + uFR_int_DesfireWriteRecord_2k3des_PK_M @2168 + uFR_int_DesfireWriteRecord_3k3des @2169 + uFR_int_DesfireWriteRecord_3k3desM @2170 + uFR_int_DesfireWriteRecord_3k3des_PK @2171 + uFR_int_DesfireWriteRecord_3k3des_PK_M @2172 + uFR_int_DesfireWriteRecord_TransMac_2k3des @2173 + uFR_int_DesfireWriteRecord_TransMac_2k3desM @2174 + uFR_int_DesfireWriteRecord_TransMac_2k3des_PK @2175 + uFR_int_DesfireWriteRecord_TransMac_2k3des_PK_M @2176 + uFR_int_DesfireWriteRecord_TransMac_3k3des @2177 + uFR_int_DesfireWriteRecord_TransMac_3k3desM @2178 + uFR_int_DesfireWriteRecord_TransMac_3k3des_PK @2179 + uFR_int_DesfireWriteRecord_TransMac_3k3des_PK_M @2180 + uFR_int_DesfireWriteRecord_TransMac_aes @2181 + uFR_int_DesfireWriteRecord_TransMac_aesM @2182 + uFR_int_DesfireWriteRecord_TransMac_aes_PK @2183 + uFR_int_DesfireWriteRecord_TransMac_aes_PK_M @2184 + uFR_int_DesfireWriteRecord_TransMac_des @2185 + uFR_int_DesfireWriteRecord_TransMac_desM @2186 + uFR_int_DesfireWriteRecord_TransMac_des_PK @2187 + uFR_int_DesfireWriteRecord_TransMac_des_PK_M @2188 + uFR_int_DesfireWriteRecord_TransMac_no_auth @2189 + uFR_int_DesfireWriteRecord_TransMac_no_auth_M @2190 + uFR_int_DesfireWriteRecord_aes @2191 + uFR_int_DesfireWriteRecord_aesM @2192 + uFR_int_DesfireWriteRecord_aes_PK @2193 + uFR_int_DesfireWriteRecord_aes_PK_M @2194 + uFR_int_DesfireWriteRecord_des @2195 + uFR_int_DesfireWriteRecord_desM @2196 + uFR_int_DesfireWriteRecord_des_PK @2197 + uFR_int_DesfireWriteRecord_des_PK_M @2198 + uFR_int_DesfireWriteRecord_no_auth @2199 + uFR_int_DesfireWriteRecord_no_authM @2200 + uFR_int_DesfireWriteStdDataFile @2201 + uFR_int_DesfireWriteStdDataFileM @2202 + uFR_int_DesfireWriteStdDataFile_2k3des @2203 + uFR_int_DesfireWriteStdDataFile_2k3desM @2204 + uFR_int_DesfireWriteStdDataFile_2k3des_PK @2205 + uFR_int_DesfireWriteStdDataFile_2k3des_PK_M @2206 + uFR_int_DesfireWriteStdDataFile_3k3des @2207 + uFR_int_DesfireWriteStdDataFile_3k3desM @2208 + uFR_int_DesfireWriteStdDataFile_3k3des_PK @2209 + uFR_int_DesfireWriteStdDataFile_3k3des_PK_M @2210 + uFR_int_DesfireWriteStdDataFile_PK @2211 + uFR_int_DesfireWriteStdDataFile_PK_M @2212 + uFR_int_DesfireWriteStdDataFile_aes @2213 + uFR_int_DesfireWriteStdDataFile_aesM @2214 + uFR_int_DesfireWriteStdDataFile_aes_PK @2215 + uFR_int_DesfireWriteStdDataFile_aes_PK_M @2216 + uFR_int_DesfireWriteStdDataFile_des @2217 + uFR_int_DesfireWriteStdDataFile_desM @2218 + uFR_int_DesfireWriteStdDataFile_des_PK @2219 + uFR_int_DesfireWriteStdDataFile_des_PK_M @2220 + uFR_int_DesfireWriteStdDataFile_no_auth @2221 + uFR_int_DesfireWriteStdDataFile_no_auth_M @2222 + uFR_int_GetDesfireUid @2223 + uFR_int_GetDesfireUidM @2224 + uFR_int_GetDesfireUid_2k3des @2225 + uFR_int_GetDesfireUid_2k3desM @2226 + uFR_int_GetDesfireUid_2k3des_PK @2227 + uFR_int_GetDesfireUid_2k3des_PK_M @2228 + uFR_int_GetDesfireUid_3k3des @2229 + uFR_int_GetDesfireUid_3k3desM @2230 + uFR_int_GetDesfireUid_3k3des_PK @2231 + uFR_int_GetDesfireUid_3k3des_PK_M @2232 + uFR_int_GetDesfireUid_PK @2233 + uFR_int_GetDesfireUid_PK_M @2234 + uFR_int_GetDesfireUid_aes @2235 + uFR_int_GetDesfireUid_aesM @2236 + uFR_int_GetDesfireUid_aes_PK @2237 + uFR_int_GetDesfireUid_aes_PK_M @2238 + uFR_int_GetDesfireUid_des @2239 + uFR_int_GetDesfireUid_desM @2240 + uFR_int_GetDesfireUid_des_PK @2241 + uFR_int_GetDesfireUid_des_PK_M @2242 + uFR_mifare_desfire_aes_key_new_with_version @2243 + uFR_mifare_desfire_des_key_new @2244 + uFR_mifare_desfire_key_free @2245 + uFR_mifare_desfire_tag_free @2246 + uFR_mifare_desfire_tag_new @2247 + uart_transceive @2248 + uart_transceiveM @2249 + write_ndef_record @2250 + write_ndef_recordM @2251 + write_ndef_record_mirroring @2252 + write_ndef_record_mirroringM @2253 + write_ndef_record_mirroring_tt @2254 + write_ndef_record_mirroring_ttM @2255 diff --git a/ufr-lib/windows/x86_64/uFCoder-x86_64.dll b/ufr-lib/windows/x86_64/uFCoder-x86_64.dll new file mode 100644 index 0000000..301361d Binary files /dev/null and b/ufr-lib/windows/x86_64/uFCoder-x86_64.dll differ